Skip to main content

doi-downloader

PyPI Version docs github license badge CI pre-commit.ci status

DOI-downloader lets you download PDFs of scientific articles by providing the DOI. It can search in several places and will automatically follow any redirects needed to obtain the PDF.

Usage

Download an article by providing the DOI as an argument:

doi-downloader 10.1038/s41586-020-2649-2
doi-downloader 10.1038/s41586-020-2649-2 -o downloads  # specify output location

A list of DOIs in a plain text file can be passed in using --file:

doi-downloader --file dois.txt  # one DOI per line

Run doi-downloader --help for all options, and see the usage documentation for details.

Installation

If you have uv on your system, you can directly run doi-downloader with:

uvx --from tmsr-doi-downloader doi-downloader 10.1038/s41586-020-2649-2

Install as a command line tool

For repeated usage, we recommend explicitly installing it as a command line tool using e.g. uv or pipx.

uv tool install tmsr-doi-downloader
# or
pipx install tmsr-doi-downloader

Once installed, you can run doi-downloader as a command from your command line.

As a Python library

To use doi-downloader as a Python library, you can install it with pip (or uv pip). Once installed, it is available to import

from doi_downloader import doi_downloader as ddl

doi = "10.1038/s41586-020-2649-2"
ddl.download(doi, output_dir="downloads")

Check examples for examples of how to use.

Developer instructions

To contribute to doi-downloader, clone the repository and use the provided make install command.

git clone git@github.com:escience-tmsr/doi-downloader.git
cd doi-downloader
make virtualenv
source .venv/bin/activate
make install

Included tests can be run with:

make test

Adding new source adapters

Create a new file in the plugins directory, and implement the Plugin class. The class should implement the following methods:

  • get_pdf_urls: This method should return the PDF URL for the given DOI.
  • fetch_metadata: This method should return the metadata for the given DOI.

Benchmarking plugin performance

This repository has code to measure, benchmark and analyse the coverage or performance of all API plugins used with doi-downloader. Performance means the ability of the plugins to find and download the PDF articles associated with a given list of DOIs (ratio of successfully downloaded PDFs to failed downloads). To run the benchmark you have to:

  1. Install the required libraries of this repo by following the instructions under the "Install" section above.
  2. Ensure you have procured the relevant API keys of the plugins you use.
  3. Add the API keys as environment variables to your operating system. Here is a useful reference for how to do this on different operating systems.
  4. Ensure you have a CSV file with two (or more) columns. One column should have a header called "doi" and hold the DOI for a paper. The second column should have a header called "domain" which holds the journal name or domain of the journal website (not URL, just the domain name) where the paper metadata can be viewed. You can then run the benchmark code using this command:

python -m benchmark.batch_download path/to/csv/file.csv

After execution, generated data for analysis can be found under benchmark/logs/... and benchmark/reports/...

To get a summary of the top performing plugins and journals run (ensure you have run the above command first):

python -m benchmark.get_top_performers

After execution, the results are written to benchmark/reports/top_performers.txt

Read the docs

Check the documentation at https://escience-tmsr.github.io/doi-downloader.

Metadata

Release files for tmsr-doi-downloader 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tmsr-doi-downloader 1.2.0
File Size Uploaded
tmsr_doi_downloader-1.2.0.tar.gz 65.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tmsr-doi-downloader 1.2.0
File Interpreter ABI Platform
tmsr_doi_downloader-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.1 kB

Release files / tmsr_doi_downloader-1.2.0.tar.gz

Download URL tmsr_doi_downloader-1.2.0.tar.gz
Size 65.2 kB
Tags Source
SHA-256 checksum
How to use checksums
15db614d2c9824105a9ee5ea422eb4da2591df028c7e55fbd956dc162b5e9ef8
BLAKE2b-256 checksum
How to use checksums
5bab8f9055434fc9711de2cda808810700557a8ad739df4045b439d30165120d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / tmsr_doi_downloader-1.2.0-py3-none-any.whl

Download URL tmsr_doi_downloader-1.2.0-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b003deacd777ffb44ac58f297d81ec2f429eafc9967207724f0d9049634f7b80
BLAKE2b-256 checksum
How to use checksums
be6ab768f7b6fa64978f9da6351d54e494699002a49ab4bfcfbb2fd3a3d1dfcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page