scihub2pdf: Python download pdf tool

2020-11-08
#Python #LaTeX

1. 简介

scihub2pdf is a module of bibcure, which downloads pdfs via a DOI number, article title or a bibtex file, using the database of libgen, Sci-Hub and Arxiv.

Github: https://github.com/bibcure/scihub2pdf

pip install scihub2pdf

Mac:

brew tap homebrew/cask
brew cask install phantomjs

Ubuntu:

sudo apt-get install phantomjs
sudo apt-get install nodejs
sudo apt-get install npm
sudo npm -g install phantomjs-prebuilt
sudo npm -g install phantomjs-prebuilt@2.1.16 --ignore-script

注意

由于scihub2pdf默认用的sci-hub的地址为: https://sci-hub.cc

需要在 /Users/name/anaconda3/lib/python3.7/site-packages/scihub2pdf的路径下的两个文件

  • scihub.py
  • download.py

修改为能用的sci-hub地址,比如: https://sci-hub.se

2. 说明

scihub2pdf -h
usage: scihub2pdf [-h] [--input INPUTFILE] [--title] [--uselibgen]
                  [--location LOCATION] [--txt]

 SciHub to PDF
 ----------------------------------------------------
 Downloads pdfs via a DOI number, article title
 or a bibtex file, using the database of libgen(sci-hub).

 Given a bibtex file

 $ scihub2pdf -i input.bib

 Given a DOI number...

 $ scihub2pdf 10.1038/s41524-017-0032-0

 Given a title...

 $ scihub2pdf --title An useful paper

 Arxiv...

 $ scihub2pdf arxiv:0901.2686

 $ scihub2pdf --title arxiv:Periodic table for topological insulators

 ## Download from list of items

 Given a text file like


 10.1038/s41524-017-0032-0
 10.1063/1.3149495
 .....

 download all pdf's

 $ scihub2pdf -i dois.txt --txt

 Given a text file like


 Some Title 1
 Some Title 2
 .....

 download all pdf's

 $ scihub2pdf -i titles.txt --txt --title

 Given a text file like


 arXiv:1708.06891
 arXiv:1708.06071
 arXiv:1708.05948
 .....

 download all pdf's

 $ scihub2pdf -i arxiv_ids.txt --txt

-----------------------------------------------------
     @author: Bruno Messias
     @email: messias.physics@gmail.com
     @telegram: @brunomessias
     @github: https://github.com/bibcure/sci2pdf

optional arguments:
  -h, --help            show this help message and exit
  --input INPUTFILE, -i INPUTFILE
                        bibtex input file
  --title, -t           download from title
  --uselibgen           Use libgen.io instead sci-hub.
  --location LOCATION, -l LOCATION
                        folder, ex: -l 'folder/'
  --txt                 Just create a file with DOI's or titles