Skip to main content

A tool to retrieve and process academic papers

Project description

PyPaperRetriever

Docs Quickstart

👉 Full Documentation
👉 Start with the Quickstart

A python package for retrieving scientific papers from the web. Inspired by PyPaperBot (https://github.com/ferru97/PyPaperBot) but with improved flexibility and extensibility. Prefers open-access sources but users can opt to use Sci-Hub as a fallback depending on their ethical considerations and local laws.

Installation

pip install pypaperretriever

Or install the latest development version directly from GitHub:

pip install git+https://github.com/josephisaacturner/pypaperretriever.git

Features

  • Download papers using DOI or PubMed ID (PMID)
  • Search PubMed programmatically with advanced query options
  • Track citation networks (both upstream and downstream) for papers of interest
  • Extract images from downloaded PDFs
  • Find all available sources from Unpaywall and optional Sci-Hub integration
  • Keep track of sources used via JSON sidecar files for each download
  • Avoid duplicate downloads with intelligent checking
  • BIDS-compatible file naming convention
  • Both command-line and Python API interfaces
  • Advanced search capabilities with customizable filters
  • Citation network analysis tools

Ethical and legal note on Sci-Hub

Use of Sci-Hub is disabled by default and clearly labeled. Institutions and researchers differ in policy and legal context; PyPaperRetriever exposes an opt-in flag so users can comply with local rules while retaining a complete pipeline for contexts where such access is permitted. The authors of PyPaperRetriever do not endorse or encourage the use of Sci-Hub in violation of local laws or institutional policies. Users are responsible for ensuring compliance with all applicable laws and ethical guidelines when using this tool.

Usage Examples

For complete examples, see examples.ipynb in the repository.

1. Download Using DOI

from pypaperretriever import PaperRetriever

retriever = PaperRetriever(
    email="your.email@gmail.com",
    doi="10.7759/cureus.76081",
    download_directory='PDFs'
)
retriever.download()

# Command-line alternative
pypaperretriever --doi 10.7759/cureus.76081 --email your.email@gmail.com --dwn-dir PDFs

2. Download Using PubMed ID

from pypaperretriever import PaperRetriever

retriever = PaperRetriever(
    email="your.email@gmail.com",
    pmid="33813262",
    download_directory='PDFs'
)
retriever.download()

# Command-line alternative
pypaperretriever --pmid 33813262 --email your.email@gmail.com --dwn-dir PDFs

3. Control Sci-Hub Access

retriever = PaperRetriever(
    email="your.email@gmail.com",
    doi="10.1016/j.revmed.2011.10.009",
    download_directory='PDFs',
    allow_scihub=False  # Set to True to enable Sci-Hub
)
retriever.download()

4. Extract Images from PDFs

from pypaperretriever import ImageExtractor

extractor = ImageExtractor('path/to/your/paper.pdf')
extractor.extract_images()

5. Search PubMed Programmatically

from pypaperretriever import PubMedSearcher

search_query = """("brain lesions"[MeSH Terms] OR "brain lesion"[Title/Abstract] OR 
                   "cerebral lesion"[Title/Abstract]) AND (case reports[Publication Type])"""

searcher = PubMedSearcher(search_string=search_query, email="your.email@gmail.com")

results = searcher.search(
    count=10,
    order_by='relevance',  # or 'chronological'
    only_open_access=False,
    only_case_reports=False
)

# Download found articles
searcher.download_articles(download_directory='PDFs', allow_scihub=True)

# Extract images from downloaded articles
searcher.extract_images()

6. Track Citation Networks

from pypaperretriever import PaperTracker

tracker = PaperTracker(
    email="your.email@gmail.com",
    doi='10.1097/RLU.0000000000001894',
    max_upstream_generations=1,   # Papers referenced by your paper
    max_downstream_generations=1  # Papers that cite your paper
)

results = tracker.track_paper()

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Citation

If you use PyPaperRetriever in your research, please cite:

Turner et al., (2025). PyPaperRetriever: A Python Tool for Finding and Downloading Scientific Literature. Journal of Open Source Software, 10(113), 8135, https://doi.org/10.21105/joss.08135

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

pypaperretriever-1.0.1.tar.gz (46.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypaperretriever-1.0.1-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file pypaperretriever-1.0.1.tar.gz.

File metadata

  • Download URL: pypaperretriever-1.0.1.tar.gz
  • Upload date:
  • Size: 46.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pypaperretriever-1.0.1.tar.gz
Algorithm Hash digest
SHA256 75a9122cbfcd107b383b077f45a6acdc3fabbebce2882ddceead9f1e39e51b43
MD5 8663fc1e981815cc60d97079b4c70ca4
BLAKE2b-256 35781983e71bfb7aff5c1bc093dbb4bd054036b623572c52aec1aa8193577a24

See more details on using hashes here.

File details

Details for the file pypaperretriever-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pypaperretriever-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb9cf42b62567e893a8c9352fb31ef37aeaec002441c47970dfca5cf1d0c7aff
MD5 79196aa4ff744826a4ea5452c4eab185
BLAKE2b-256 e4a75a6af41c0d110978eda8f9201d40ba8fa7f90468d68bfcded1fc35d64a03

See more details on using hashes here.

Supported by

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