这个我就不多说了,直接上代码,大家可以直接拿走用
[Python] 纯文本查看 复制代码 # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import _thread
import datetime
import hashlib
import pprint
import string
import struct
import threading
import time
import requests
count = 107997 # 声明全局变量
lock = threading.Lock() # 申请一把锁
def postcurl(i):
print("线程",i,"启动")
global count # 引用全局变量
while count < 123456:
url = 'http://data.zz.baidu.com/urls?site=tool.sufeinet.com&token=你自己的密匙'
headers = {
'Content-Type': 'text/plain',
'User-Agent': 'curl/7.12.1',
'Referer': "http://tool.sufeinet.com"
}
lock.acquire() # 加锁
count += 1
lock.release() # 释放锁
# 获取数据
curl = "http://tool.sufeinet.com/Encrypt/MD5.aspx?action=Decode&md5str=" + count.__str__()
str_html = requests.post(url, data=curl, headers=headers)
# 输出获取到的 as html
print("线程", i, "正在执行:", str_html.text + "__" + curl)
print("循环结束")
# 主方法,程序的开始
if __name__ == '__main__':
try:
for i in range(1, 30):
time.sleep(1)
_thread.start_new_thread(postcurl, (i,))
except:
print("Error: 无法启 动线程")
while 1:
pass
|