欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#實(shí)現(xiàn)的中國(guó)移動(dòng)官網(wǎng)手機(jī)號(hào)碼采集器

 更新時(shí)間:2014年10月31日 09:24:31   投稿:junjie  
這篇文章主要介紹了C#實(shí)現(xiàn)的中國(guó)移動(dòng)官網(wǎng)手機(jī)號(hào)碼采集器,本文先是采集號(hào)碼入庫(kù),同時(shí)給出了篩選各類靚號(hào)的SQL語(yǔ)句,需要的朋友可以參考下

早幾天要換號(hào)碼,到移動(dòng)營(yíng)業(yè)廳去辦說稍微看的順眼的號(hào)碼就要預(yù)存多少多少。我覺得好坑,但是在官網(wǎng)又找不到稍微順眼的。無(wú)奈之下沒辦法寫了這個(gè)采集軟件。主要是想彌補(bǔ)官網(wǎng)搜索不方便的缺陷。下面上代碼,比較簡(jiǎn)單:

復(fù)制代碼 代碼如下:

static void Main(string[] args)
{
    string[] t = { "134", "135", "136", "137", "138", "139", "147", "150", "151", "152", "157", "158", "159", "182", "183", "187", "188" };
    string numberPattern = @"<a data-original-title="" title="">.*?)""(.*?)</a>";
 
    for (int i = 0; i < t.Length; i++)
    {
        int pageCount = 1;
        int page = 0;
        string postdata = "page={0}&tdShopSelectionSuc.mobileType=0&tdShopSelectionSuc.selectArea=0731&tdShopSelectionSuc.selectAreaName=%E9%95%BF%E6%B2%99&tdShopSelectionSuc.numberSeg={1}________&tdShopSelectionSuc.numberRule=&tdShopSelectionSuc.searchStr=___________&tdShopSelectionSuc.endNumberRule=&tdShopSelectionSuc.storedValueStart=&tdShopSelectionSuc.storedValueEnd=&tdShopSelectionSuc.compositor=2&tdShopSelectionSuc.switchList=0&retryQuery=yes&numPriceSort=&numSort=1&pages.pageSize=15";
        string posturl = "https://www.hn.10086.cn/Shopping/selects/nos_queryPhoneInfo.action?timeStamp=" + ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000) + "" + new Random().Next(100, 999);
 
        for (int p = 0; p < pageCount; p++)//翻頁(yè)
        {
            Console.WriteLine("正在獲取{0}的所有號(hào)碼,當(dāng)前頁(yè)碼:{1}", t[i], page);
            string html = HttpHelper.GetHtml(posturl, string.Format(postdata, page, t[i]), true);
            if (html == "") { continue; }
            if (pageCount == 1)
            {
                pageCount = int.Parse(Regex.Match(html, @"var pageCount = '(?.*?)';").Groups["value"].Value);
            }
            MatchCollection ms = Regex.Matches(html, numberPattern);
            foreach (Match m in ms)
            {
                string number = m.Groups["value"].ToString();
                if (!Exists(number))
                {
                    DbHelperSQL.ExecuteSql("INSERT INTO Number(Number)VALUES('" + number + "')");
                }
                Console.WriteLine("號(hào)碼:" + number);
            }
            page++;
        }
    }
    Console.WriteLine("結(jié)束.");
    Console.ReadKey();
}

既然號(hào)碼采集到數(shù)據(jù)庫(kù)了,那就順便寫個(gè)SQL把心儀的號(hào)碼篩選出來(lái)吧:

ABAB型:

復(fù)制代碼 代碼如下:

select * from telephone where SUBSTRING(telenumber,8,2)=SUBSTRING(telenumber,10,2) and SUBSTRING(telenumber,8,1)!=SUBSTRING(telenumber,11,1);

AABB型:

復(fù)制代碼 代碼如下:

select * from telephone where SUBSTRING(telenumber,8,1)=SUBSTRING(telenumber,9,1) and SUBSTRING(telenumber,10,1)=SUBSTRING(telenumber,11,1) and SUBSTRING(telenumber,8,1)!=SUBSTRING(telenumber,11,1);

AAAB型:

復(fù)制代碼 代碼如下:

select * from telephone where SUBSTRING(telenumber,8,1)=SUBSTRING(telenumber,9,1) and SUBSTRING(telenumber,9,1)=SUBSTRING(telenumber,10,1) and SUBSTRING(telenumber,8,1)!=SUBSTRING(telenumber,11,1);

ABBB型:

復(fù)制代碼 代碼如下:

select * from telephone where SUBSTRING(telenumber,9,1)=SUBSTRING(telenumber,10,1) and SUBSTRING(telenumber,11,1)=SUBSTRING(telenumber,10,1) and SUBSTRING(telenumber,8,1)!=SUBSTRING(telenumber,11,1);

AAAA型:

復(fù)制代碼 代碼如下:

select * from telephone where SUBSTRING(telenumber,8,2)=SUBSTRING(telenumber,10,2) and SUBSTRING(telenumber,8,1)=SUBSTRING(telenumber,11,1);

相關(guān)文章

最新評(píng)論