from fake_useragent import UserAgent
# 没有 fake_useragent 库 可以使用pip安装
# pip install fake-useragent
def down_SCI_pdf(doi, downfile):
"""
:param doi: 需要下载文献的 doi 号
:param downfile: pdf 需要保存的位置
:return:
"""
headers = {'User-Agent': UserAgent().chrome}
try:
download_url = f'https://sci.bban.top/pdf/{doi}.pdf' # 下载地址
print(f'The download url is: {download_url}')
download_r = requests.get(download_url, headers=headers)
download_r.raise_for_status() # 判断响应状态
with open(f'{downfile}', "wb+") as temp:
temp.write(download_r.content)
print(f"{download_url} download successfully.\n")
except Exception as e:
print(e)
if __name__ == '__main__':
doi = '10.1109/SCIS-ISIS.2018.00051'
title = 'Autonomous Machine Learning Modeling using a Task Ontology'
downfile = f'./{title}.pdf'
down_SCI_pdf(doi, downfile)
使用python下载SCI文献
最新推荐文章于 2024-05-16 20:16:30 发布