sci-dl: help you download SciHub PDF programmatically
Project description
sci-dl: help you download SciHub PDF faster
Features
- 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.
Installation
use as command line software
pip install 'sci-dl[cmd]'
use as Python library
pip install sci-dl
Usage
use as command line software
- 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
use as Python library
sci_dl.SciDlError raises when exception happens.
if you don't have a proxy
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)
if you use a proxy
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)
how to save response?
get all content one time
with open('xxx.pdf', 'wb') as fp:
fp.write(response.content)
chunk by chunk
with open('xxx.pdf', 'wb') as fp:
for chunk in response.iter_content(1024): # 1024 is the chunk size
fp.write(chunk)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sci-dl-0.1.2.tar.gz
(8.4 kB
view details)
Built Distribution
File details
Details for the file sci-dl-0.1.2.tar.gz
.
File metadata
- Download URL: sci-dl-0.1.2.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.0 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.59.0 importlib-metadata/4.11.1 keyring/23.0.0 rfc3986/1.4.0 colorama/0.4.4 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2c9f5f5b72a37af1ae704b71fc3ccdf29c173594396559b6f01f2161fb8dc21 |
|
MD5 | 7b5d06ab2241c87782a906b1a72cc282 |
|
BLAKE2b-256 | b844f5a75254a69a39c78ccb0cd949337b0b8568f5b5be07fd5c02b2658c3538 |
File details
Details for the file sci_dl-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: sci_dl-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.0 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.59.0 importlib-metadata/4.11.1 keyring/23.0.0 rfc3986/1.4.0 colorama/0.4.4 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 344395c61225d8b1e44835ba368b171a7605f5aa690f2d516e3c834b4fc0e60e |
|
MD5 | 73797009b91d8fcac0d7435947b645f1 |
|
BLAKE2b-256 | 88f7dfa3e6c9671201ca5f06d79ff19090c4da74b6f46c0f381877f987110058 |