Skip to main content

sci-dl: help you download SciHub PDF programmatically

Project description

sci-dl: help you download SciHub PDF faster

Features

  1. configuration file support.
  2. search by Google Scholar(coming soon).
  3. download using DOI.
  4. custom SciHub mirror url.
  5. proxy support.
  6. failure retry.
  7. captacha support(coming soon).
  8. 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

  1. initialization configuration file
sci-dl init-config

follow the prompt to create the configuration file.

  1. 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)

Uploaded Source

Built Distribution

sci_dl-0.1.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

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

Hashes for sci-dl-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e2c9f5f5b72a37af1ae704b71fc3ccdf29c173594396559b6f01f2161fb8dc21
MD5 7b5d06ab2241c87782a906b1a72cc282
BLAKE2b-256 b844f5a75254a69a39c78ccb0cd949337b0b8568f5b5be07fd5c02b2658c3538

See more details on using hashes here.

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

Hashes for sci_dl-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 344395c61225d8b1e44835ba368b171a7605f5aa690f2d516e3c834b4fc0e60e
MD5 73797009b91d8fcac0d7435947b645f1
BLAKE2b-256 88f7dfa3e6c9671201ca5f06d79ff19090c4da74b6f46c0f381877f987110058

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page