2 Star 2 Fork 0

nmwap/python爬虫-com域名注册信息爬虫

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
myThread.py 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
青年码农 提交于 2019-01-16 13:40 . 提交
#!usr/bin/python3
# -*- coding:utf-8 -*-
# 爬取阿里云com指定位数域名信息
from getdomainName import savecom
from regcom import getcom
import threading
def getlistdata():
print("数据解析开始...")
of = open('totallist.txt','r',encoding='utf-8')
a = of.read()
totallist = eval(a).split(",")
of.close()
# 判断数据len
if len(totallist) < 100000:
print("数据量比较小,单线程工作")
t1 = threading.Thread(target=getcom,args=(totallist,0,len(totallist)))
t1.start()
else :
print("数据量比较大,拆分多个线程")
Threadlist = {}
i = 0
while i < (len(totallist)//100000) + 1:
strNo = "t"+str(i)
Threadlist[strNo]=i
i = i+1
for key in Threadlist:
if Threadlist[key]*100000+100000 > len(totallist):
print("线程%s开始工作"%(key))
key = threading.Thread(target=getcom,args=(totallist,Threadlist[key]*100000,len(totallist)))
# print(Threadlist[key]*100000)
# print(len(totallist))
print("最后的")
key.start()
else:
print("线程%s开始工作"%(key))
key = threading.Thread(target=getcom,args=(totallist,Threadlist[key]*100000,Threadlist[key]*100000+100000))
# print(Threadlist[key]*100000)
# print(Threadlist[key]*100000+100000)
key.start()
if __name__ == '__main__':
# 创建totallist.txt
totallist = open('totallist.txt','w+', encoding='utf-8')
totallist.write("\"nmgwap\"")
totallist.close()
# 获取组合总数据
savecom()
# 分析总数据,拆分线程
getlistdata()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/nmwap/python_com.git
git@gitee.com:nmwap/python_com.git
nmwap
python_com
python爬虫-com域名注册信息爬虫
master

搜索帮助

Cb406eda 1850385 E526c682 1850385