Scihub에서 논문을 다운로드하기위한 비공식 API.
# Download with a DOI and filenmae is the paper's title.
$ scidownl download --doi https://doi.org/10.1145/3375633
# Download with a PMID and a user-defined filepath
$ scidownl download --pmid 31395057 --out ./paper/paper-1.pdf
# Download with a title
$ scidownl download --title " ImageNet Classification with Deep Convolutional Neural Networks " --out ./paper/paper-1.pdf
# Download with a proxy: SCHEME=PROXY_ADDRESS
$ scidownl download --pmid 31395057 --out ./paper/paper-1.pdf --proxy http=socks5://127.0.0.1:7890
Scidownl은 PIP로 쉽게 설치할 수 있습니다.
$ pip3 install -U scidownl
$ git clone https://github.com/Tishacy/SciDownl.git
$ cd Scidownl && python3 setup.py install
$ scidownl -h
Usage: scidownl [OPTIONS] COMMAND [ARGS]...
Command line tool to download pdfs from Scihub.
Options:
-h, --help Show this message and exit.
Commands:
config Get global configs.
domain.list List available SciHub domains in local db.
domain.update Update available SciHub domains and save them to local db.
download Download paper(s) by DOI or PMID.
$ scidownl domain.update --help
Usage: scidownl domain.update [OPTIONS]
Update available SciHub domains and save them to local db.
Options:
-m, --mode TEXT update mode, could be ' crawl ' or ' search ' , default mode is
' crawl ' .
-h, --help Show this message and exit.
옵션으로 지정할 수있는 2 개의 업데이트 모드가 있습니다 : -m
또는 --mode
crawl
: [기본값] 실시간 업데이트 된 Scihub Domains 웹 사이트 (일명, Scihub 도메인 소스)를 크롤링하여 사용 가능한 Scihub 도메인을 얻습니다. Scihub 도메인 소스 웹 사이트 URL은 scihub_domain_source
의 키와 함께 [scihub.domain.updater.crawl]
섹션의 글로벌 구성 파일에 구성됩니다. scidownl config --location
사용하여 글로벌 구성 파일의 위치를 표시하고 편집 할 수 있습니다.
; Global config file: global.ini
; ...
[scihub.domain.updater.crawl]
scihub_domain_source = http://tool.yovisun.com/scihub
; ...
crawl
모드 사용의 예 :
$ scidownl domain.update --mode crawl
[INFO] | 2022/03/07 21:07:50 | Found 6 valid SciHub domains in total: [ ' http://sci-hub.ru ' , ' http://sci-hub.se ' , ' https://sci-hub.ru ' , ' https://sci-hub.st ' , ' http://sci-hub.st ' , ' https://sci-hub.se ' ]
[INFO] | 2022/03/07 21:07:50 | Saved 6 SciHub domains to local db.
search
: Scihub 도메인의 규칙에 따라 조합을 생성하고 사용 가능한 Scihub 도메인을 검색합니다. crawl
모드보다 오래 걸립니다.
search
모드 사용의 예 :
$ scidownl domain.update --mode search
[INFO] | 2022/03/07 21:08:44 | # Search valid SciHub domains from 1352 urls
[INFO] | 2022/03/07 21:08:48 | # Found a SciHub domain url: https://sci-hub.ru
[INFO] | 2022/03/07 21:08:48 | # Found a SciHub domain url: https://sci-hub.st
...
[INFO] | 2022/03/07 21:09:04 | Found 6 valid SciHub domains in total: [ ' https://sci-hub.ru ' , ' https://sci-hub.st ' , ...]
[INFO] | 2022/03/07 21:09:04 | Saved 6 SciHub domains to local db.
Scidownl은 SQLITE를 로컬 데이터베이스로 사용하여 업데이트 된 모든 SCIHUB 도메인을 로컬로 저장합니다. 저장된 모든 SCIHUB 도메인을 명령 domain.list
사용하여 나열 할 수 있습니다.
$ scidownl domain.list
+--------------------+----------------+---------------+
| Url | SuccessTimes | FailedTimes |
| --------------------+----------------+--------------- |
| http://sci-hub.ru | 0 | 0 |
| https://sci-hub.ru | 0 | 0 |
| https://sci-hub.st | 0 | 0 |
| http://sci-hub.st | 0 | 0 |
| https://sci-hub.se | 0 | 0 |
| http://sci-hub.se | 0 | 0 |
+--------------------+----------------+---------------+
이해하기 쉬운 URL 열 외에도 SuccessTimes
열은이 URL을 사용하여 성공적인 종이 다운로드 횟수를 기록하는 데 사용되며 FailedTimes
열은이 URL을 사용하여 실패한 용지 다운로드 수를 기록하는 데 사용됩니다. 이 두 열은 용지를 다운로드 할 때 Scihub 도메인을 선택하는 우선 순위를 계산하는 데 사용됩니다.
$ scidownl download --help
Usage: scidownl download [OPTIONS]
Download paper(s) by DOI or PMID.
Options:
-d, --doi TEXT DOI string. Specifying multiple DOIs is supported,
e.g., --doi FIRST_DOI --doi SECOND_DOI ...
-p, --pmid INTEGER PMID numbers. Specifying multiple PMIDs is supported,
e.g., --pmid FIRST_PMID --pmid SECOND_PMID ...
-t, --title TEXT Title string. Specifying multiple titles is
supported, e.g., --title FIRST_TITLE --title
SECOND_TITLE ...
-o, --out TEXT Output directory or file path, which could be an
absolute path or a relative path. Output directory
examples: /absolute/path/to/download/,
./relative/path/to/download/, Output file examples:
/absolute/dir/paper.pdf, ../relative/dir/paper.pdf.
If --out is not specified, paper will be downloaded
to the current directory with the file name of the
paper's title. If multiple DOIs or multiple PMIDs are
provided, the --out option is always considered as
the output directory, rather than the output file
path.
-u, --scihub-url TEXT Scihub domain url. If not specified, automatically
choose one from local saved domains. It's recommended
to leave this option empty.
-h, --help Show this message and exit.
옵션 -d
또는 --doi
사용하여 doi, 옵션 -p
또는 --pmid
로 종이를 다운로드하여 pmid와 함께 종이를 다운로드하고 옵션 -t
또는 --title
타이틀을 다운로드 할 수있는 옵션을 다운로드하십시오. 이 옵션을 여러 번 지정하고 심지어 혼합 할 수도 있습니다.
# with a single DOI
$ scidownl download --doi https://doi.org/10.1145/3375633
# with multiple DOIs
$ scidownl download --doi https://doi.org/10.1145/3375633 --doi https://doi.org/10.1145/2785956.2787496
# with a single PMID
$ scidownl download --pmid 31395057
# with multiple PMIDs
$ scidownl download --pmid 31395057 --pmid 24686414
# with a single title
$ scidownl download --title " ImageNet Classification with Deep Convolutional Neural Networks "
# with multiple titles
$ scidownl download --title " ImageNet Classification with Deep Convolutional Neural Networks " --title " Aggregated residual transformations for deep neural networks "
# with a mix of DOIs and PMIDs
$ scidownl download --doi https://doi.org/10.1145/3375633 --pmid 31395057 --pmid 24686414
기본적으로 다운로드 된 용지는 논문의 제목에 따라 명명되었습니다. 옵션 -o
또는 --out
사용하면 다운로드 된 용지의 출력 위치를 사용자 정의 할 수 있습니다.
PAEPR을 디렉토리로 출력하십시오.
$ scidownl download --pmid 31395057 --out /absolute/path/of/a/directory/
# NOTE that the '/' at the end of the directory path is required, otherwise the last segment will be treated as the filename rather than a directory.
$ scidownl download --pmid 31395057 --out ../relative/path/of/a/directory/
# The '/' at the end of the directory path is required too.
파일 경로로 용지를 출력하십시오.
$ scidownl download --pmid 31395057 --out /absolute/dir/paper.pdf
$ scidownl download --pmid 31395057 --out ../relative/dir/paper.pdf
$ scidownl download --pmid 31395057 --out relative/dir/paper.pdf
$ scidownl download --pmid 31395057 --out paper # will be downlaoded as ./paper.pdf
다운로드해야 할 논문이 둘 이상인 경우 --out
옵션의 값은 항상 파일 경로가 아닌 디렉토리로 간주됩니다.
$ scidownl download --pmid 31395057 --pmid 24686414 --out paper
# will be downloaded to ./paper/ directory:
# ./paper/<paper-title-1>.pdf
# ./paper/<paper-title-2>.pdf
옵션의 일부 디렉토리가 존재하지 않으면 Scidownl이 귀하를 위해 만들 것입니다.
옵션 -u
또는 --scihub-url
사용하면 Scidownl이 로컬 저장된 Scihub 도메인에서 자동으로 하나를 선택하도록하는 대신 원하는 특정 Scihub URL을 사용할 수 있습니다. Scidownl이 Scihub URL을 선택할 수 있도록 권장되므로 정상적인 사용 으로이 옵션을 사용할 필요가 없습니다.
$ scidownl download --pmid 31395057 --scihub-url http://sci-hub.se
scihub_download
기능을 사용하여 종이를 다운로드 할 수 있습니다.
from scidownl import scihub_download
paper = "https://doi.org/10.1145/3375633"
paper_type = "doi"
out = "./paper/one_paper.pdf"
proxies = {
'http' : 'socks5://127.0.0.1:7890'
}
scihub_download ( paper , paper_type = paper_type , out = out , proxies = proxies )
예에서는 더 많은 예가 볼 수 있습니다.
저작권 (C) 2022 Tishacy.
MIT 라이센스에 따라 라이센스.