|
发表于 2020-7-12 11:52:04
|
显示全部楼层
本帖最后由 suchocolate 于 2020-7-12 13:50 编辑
- import requests
- url = 'https://sci-hub.tw/downloads/2020-07-10/23/10.1126@science.aay5663.pdf'
- headers = {'Host': 'sci-hub.tw',
- 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0',
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
- 'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Connection': 'keep-alive',
- 'Referer': 'https://sci-hub.tw/10.1126/science.aay5663',
- 'Cookie': '__ddg1=KBCRwlHgnKghCvEgEK4S; session=6f3048c2d9a48e0aa3201e27928dfe8e; refresh=1594524422.6663',
- 'Upgrade-Insecure-Requests': '1'}
- r = requests.get(url, headers=headers)
- with open('test.pdf', 'wb') as f:
- f.write(r.content)
复制代码 |
|