#coding:utf-8
import time
import requests
import random
headers = {
'if-none-match': '"60a5c01e-c097"',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'cache-control': 'max-age=0',
'authority': 'abook.hep.com.cn',
'if-modified-since': 'Thu, 20 May 2021 01:49:18 GMT',
}
for i in range(1,69): #src="https://abook.hep.com.cn:443/ICourseFiles/5000003829/swfresourses/2021/5/20/1621472335126/1621472335126.html"
response = requests.get('https://abook.hep.com.cn/ICourseFiles/5000003829/swfresourses/2021/5/20/1621471636267/1621471636267.files/%s.png'%(i), headers=headers)
url = "images/%s.png"%(i)
print(url)
with open(url,'wb' ) as f:
f.write(response.content)
time.sleep(random.randint(5, 8))
网友评论