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
28
29
30
31
32
33
34
35
36
from concurrent.futures import ThreadPoolExecutor
import time
import requests

r=requests.session()

def requestUrl(url):
response = requests.get(url) #下载页面
if "lv6.png" in response.text:
print(response.url)
return response
#
# 回调函数
#def done(future,*args,**kwargs):
# response = future.result() #取得future对象进行操作
# if "lv6.png" in response.text:
# print(response.url)
#

def main():
url="http://c8d9a312-36e4-442f-8d1c-b5f14a5290b9.node3.buuoj.cn/"
user={"_xsrf":"2%7Cd9aca2c4%7C141a48c4004d577321918c738b2c5968%7C1584286112","username":"sa","password":"sa"}
r.post(url,data=user)
seed=[ url+"shop?page="+str(i) for i in range(1,500) ]

# with ThreadPoolExecutor(10) as executor:
# for each in seed:
# executor.submit(requestUrl,each).add_done_callback(done)
# print("----------------")
# time.sleep(5)

with ThreadPoolExecutor(max_workers=10) as executor1:
executor1.map(requestUrl,seed)

if __name__ == '__main__':
main()