zoukankan      html  css  js  c++  java
  • 抓取淘宝分类

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Net;
    using System.Text.RegularExpressions;
    using System.IO;

    namespace taobao_trades_sold_get
    {
        class Program
        {
            public static void Main(string[] args)
            {
                //taobao_trades_sold_get.OrderDown down = new OrderDown();
                //down.Oreder();

    ================================================================

    读文件

    ================================================================

                FileStream file = new FileStream(@"d:\\sa.txt", FileMode.Open);
                byte[] bt = new byte[file.Length];
                file.Read(bt, 0, bt.Length);
                string str = Encoding.Default.GetString(bt);
                string Id = "";
                string s = "";

    =====================================================================

    正则组匹配

    =====================================================================

                Regex regexid = new Regex("name-(\\d{0,9})\" data-id?(.+)class=\"text J_CatName\" value=\"(.+)\"  data-condition=?", RegexOptions.Compiled);

                MatchCollection mc = regexid.Matches(str);
                foreach (Match m in mc)
                {

                    Id = m.Groups[1].Value;
                    s = m.Groups[3].Value;
                    string sql = string.Format("insert into dbo.CategoriesTaobaodian_WeiRan(taobaoDian_CategoryID,taobaoDian_Categoryname) values('{0}','{1}')",Id, s);
                    DataDrive.sqlDataConn.connGetDataSetByExecSql(sql);
                 
                        Console.WriteLine(s);
                    Console.WriteLine(Id);
                }
                Console.ReadKey();
                    
                    }
            
              
                    }

            }

  • 相关阅读:
    charles使用教程指南
    根域名服务器 根服务器一般指根域名服务器 (DNS)
    DNS原理及其解析过程【精彩剖析】
    代理工具Charles使用
    cisco 为每个单独的人员设置不同的用户名和密码
    大数据架构:flume-ng+Kafka+Storm+HDFS 实时系统组合
    KAFKA分布式消息系统
    Android 监听屏幕锁屏,用户解锁
    如何判断微信内置浏览器
    Android,iOS,浏览器打开手机QQ与指定用户聊天界面
  • 原文地址:https://www.cnblogs.com/happygx/p/1957872.html
Copyright © 2011-2022 走看看