Yard line and personally, crawling phone number belonging to the latest data (201,911)

One day, a department head of the little sister: To identify the recipient mobile phone number belonging to the order, so the client can refer to determine whether orders malicious.
Moving bricks Jun: Yes, there are two options;
    a, buy online API interface (requires RMB support);
    Second, find a mobile phone ownership to the library (free, there may not be current);
little sister: Application for RMB, estimated leadership not it would sign, then free it.
Moving bricks Jun: Well, (this time the hearts of ten thousand ... (you know));

 

 

 

So a search of the latest mobile phone number belonging to the database is actually ranked first in the garden master, and instantly excited,

 

 


Open the link to see the github, do not go thinking that this code line and find the data. Each folder is only the result of a search query methods, but no library.
And then look down the original library is buying links, as well as upgrade link. It seems that a dead end road.

 

 

The ability to turn the other search results at a certain degree, or not current, or charge, or is login required points to download.
I thought to find a API interface data line and put him out just fine. To proceed with a degree of phone numbers for attribution API interface,
tested, than to find the four available and higher reliability.

 

 

 

Yard line and start [Sorry, data sources, and data warehousing small screen please fill the partner of their brain]:

private static List<string> MobileList = new List<string>();
// 中途中断后, 已经存在的手机号段列表
using (SqlConnection conn = new SqlConnection(ConStr))
{
    if (MobileList.Count == 0)
    {
        string temp_sql = $"SELECT [Mobile] From [App_Mobile_20191113]";
        using (SqlCommand command = new SqlCommand(temp_sql, conn))
        {
            command.CommandType = System.Data.CommandType.Text;
            if (conn.State == ConnectionState.Closed) conn.Open();
            using (SqlDataReader dreader = command.ExecuteReader())
            {
                while (dreader.Read())
                {
                    MobileList.Add(dreader[0].ToString());
                }
            }
        }
    }
}

A number of the top three thread segments

List<Task> taskList = new List<Task>();
TaskFactory taskFactory = new TaskFactory();
// 从手机前3位 130 开始 至 199 结束
for (int i = 130; i < 200; i++)
{
    int mobile_no = i;
    taskList.Add(taskFactory.StartNew(() =>
    {
        Console.WriteLine($"{mobile_no} = {Thread.CurrentThread.ManagedThreadId}");
        Get(mobile_no);
    }));
}
Task.WaitAll(taskList.ToArray());

Begin acquiring data

void the Get static (int start_no) 
{ 
    int = start_mobile the int.Parse ($ "} {start_no 0000"); 
    int = end_mobile the int.Parse ($ "} {start_no 9999"); 
    // get all begin at a certain number of segments eg: of 1300000 - 1,309,999 
    for (int I = start_mobile; I <= end_mobile; I ++) 
    { 
        IF (MobileList.Contains (i.ToString ())) Continue; // number already exists 
        int code = new Random () Next . (1000, 9999); // random phone number last four 
        String Mobile $ = "{i} {code}"; 
        // get data [sorry, data sources small screen please fill the partner of their brain] 
        ModelMobile model = Get1 ( mobile); // data source. 1 
        IF) = Get2 Model (Mobile) (model.QueryResult || string.IsNullOrWhiteSpace (model.Province!); // data source 2
        if (! model.QueryResult || string.IsNullOrWhiteSpace (model.Province )) model = Get3 (mobile); // data source. 3 
        IF = Get4 Model ((|| model.QueryResult string.IsNullOrWhiteSpace (model.Province)!) mobile); // data source 4 
        // [storage warehousing after successfully acquiring small screen please fill the partner of their brain] 
        IF (model.QueryResult) 
        { 
            IF (save_data (Model)) 
                Console.WriteLine ($ "{the Thread. Success} CurrentThread.ManagedThreadId \ T {I} = {{} model.Province model.City} ({model.Corp}) [{model.Source}] ...... ");. 
            the else 
                Console.WriteLine ( $ "{Thread.CurrentThread.ManagedThreadId} SaveFail \ t {i} = {model.Province} {model.City} ({model.Corp}) [{model.Source}] ......."); 
        } 
        the else
            Console.WriteLine($" {Thread.CurrentThread.ManagedThreadId}. Fail \t{i} = {model.Message} [{model.Source}] ......");
    }
}

running result:

 

After all climbed paragraph, data total 442,245, more than a master of the first row of the garden.

 

 

 

As long as the source data is normal, this library also can always upgrade properly.
Line and yard completion, the courage to go and notice the little sister, can be a normal call.

 

Guess you like

Origin www.cnblogs.com/im531/p/11858017.html