- configuration file support.
- search by Google Scholar(coming soon).
- download using DOI.
- custom SciHub mirror url.
- proxy support.
- failure retry.
- captacha support(coming soon).
- a Python library that can be embedded in your program.
pip install 'sci-dl[cmd]'
pip install sci-dl
- initialization configuration file
sci-dl init-config
follow the prompt to create the configuration file.
- download using DOI
sci-dl dl -d '10.1016/j.neuron.2012.02.004'
# 10.1016/j.neuron.2012.02.004 is the article DOI you want to download
sci_dl.SciDlError raises when exception happens.
from sci_dl import dl_by_doi
config = {
'base_url': 'https://sci-hub.se', # sci-hub URL
'retries': 5, # number of failure retries
'use_proxy': False # means you don't want to use a proxy
}
response = dl_by_doi('10.1016/j.neuron.2012.02.004', config)
from sci_dl import dl_by_doi
config = {
'base_url': 'https://sci-hub.se', # sci-hub URL
'retries': 5, # number of failure retries
'use_proxy': True, # means you don't want to use a proxy
'proxy_protocol': 'socks5', # available protocols: http https socks5
'proxy_user': None, # proxy user, if your proxy don't need one, you can pass None
'proxy_password': None, # proxy password, if your proxy don't need one, you can pass None
'proxy_host': '127.0.0.1', # proxy host
'proxy_port': 1080 # proxy port
}
response = dl_by_doi('10.1016/j.neuron.2012.02.004', config)
with open('xxx.pdf', 'wb') as fp:
fp.write(response.content)
with open('xxx.pdf', 'wb') as fp:
for chunk in response.iter_content(1024): # 1024 is the chunk size
fp.write(chunk)