-
C#教程之亲手撸码,爬取 手机号码归属地最新数据(201911)(2)
开始获取数据
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
static void Get( int start_no) { int start_mobile = int .Parse($ "{start_no}0000" ); int end_mobile = int .Parse($ "{start_no}9999" ); // 获取某开头下的所有号码段 如: 1300000 - 1309999 for ( int i = start_mobile; i <= end_mobile; i++) { if (MobileList.Contains(i.ToString())) continue ; //已经存在的号码 int code = new Random().Next(1000, 9999); // 随机手机号码最后4位 string mobile = $ "{i}{code}" ; //获取数据 【抱歉,数据来源画面请各位小伙伴自行脑补】 ModelMobile model = Get1(mobile); // 数据源1 if (!model.QueryResult || string .IsNullOrWhiteSpace(model.Province)) model = Get2(mobile); // 数据源2 if (!model.QueryResult || string .IsNullOrWhiteSpace(model.Province)) model = Get3(mobile); // 数据源3 if (!model.QueryResult || string .IsNullOrWhiteSpace(model.Province)) model = Get4(mobile); // 数据源4 //获取成功后入库【入库画面请各位小伙伴自行脑补】 if (model.QueryResult) { if (save_data(model)) Console.WriteLine($ " {Thread.CurrentThread.ManagedThreadId}. Success \t{i} = {model.Province} {model.City} ({model.Corp}) [{model.Source}] ......" ); else Console.WriteLine($ " {Thread.CurrentThread.ManagedThreadId}. SaveFail \t{i} = {model.Province} {model.City} ({model.Corp}) [{model.Source}] ......" ); } else Console.WriteLine($ " {Thread.CurrentThread.ManagedThreadId}. Fail \t{i} = {model.Message} [{model.Source}] ......" ); } } |
栏目列表
最新更新
C#中PadLeft,PadRight的用法
亲手撸码,爬取 手机号码归属地最新数据
C#中获取多个对象list中对象共有的属性项
浅拷贝与深拷贝
三元運算子回傳lambda expression
C#斐波那契数列求法(比较阶乘和循环所
C# 实现敏感词过滤
NPOI 导出 excel 性能测试
C# Random
C# if语句
.Net Standard(.Net Core)实现获取配置信息
Linux PXE + Kickstart 自动装机
Shell 编程 基础
Shell 编程 条件语句
CentOS8-网卡配置及详解
Linux中LVM逻辑卷管理
1.数码相框-相框框架分析(1)
Ubuntu armhf 版本国内源
Linux中raid磁盘阵列
搭建简易网站
如何远程连接SQL Server数据库的图文教程
复制SqlServer数据库的方法
搜索sql语句
sql中返回参数的值
sql中生成查询的模糊匹配字符串
数据定义功能
数据操作功能
将Session值储存于SQL Server中
使用SQL Server数据库嵌套子查询的方法
SQL概述