Skip to main content

huntpdf

image

A Python-based CLI tool to fetch PDFs of arxiv, DOI, and PubMed articles.

Installation

pip install huntpdf
playwright install chromium  # one-time setup for browser fallback

Usage

huntpdf <query> [-o OUTPUT]

Where <query> can be:

Input Type Example
arXiv ID huntpdf 2301.07041
DOI huntpdf 10.1038/nature12373
PMC ID huntpdf PMC4056847
PubMed ID huntpdf 25428566
URL huntpdf https://arxiv.org/abs/2301.07041

Output is JSON:

{"status": "success", "pdf_path": "/absolute/path/to/file.pdf"}

Options

  • -o, --output PATH — Save PDF to a specific path (default: auto-generated in current directory)

Supported URL patterns

  • arxiv.org/abs/{id} and arxiv.org/pdf/{id}
  • doi.org/{doi}
  • pubmed.ncbi.nlm.nih.gov/{pmid}
  • pmc.ncbi.nlm.nih.gov/articles/{PMCID}
  • Direct PDF links (any URL serving application/pdf)
  • Other URLs (attempted via headless browser fallback)

Download strategy

For each URL, huntpdf tries:

  1. Direct HTTP download — fast streaming via httpx
  2. Headless browser — Playwright-based fallback for JavaScript-rendered pages

For DOI lookups specifically, if the Unpaywall PDF URL fails (e.g. paywall), huntpdf queries the Semantic Scholar API for alternate open-access copies and tries existing resolvers (arXiv, PMC) with the discovered identifiers.

Environment variables

  • UNPAYWALL_EMAIL (required for DOI lookups) — Your email address for Unpaywall API requests

Development

pip install -e ".[dev]"
pytest

Run only unit tests (skip integration tests that hit real APIs):

pytest -m "not integration"

Metadata

Release files for huntpdf 1.0.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 huntpdf 1.0.0
File Size Uploaded Provenance
huntpdf-1.0.0.tar.gz 15.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for huntpdf 1.0.0
File Interpreter ABI Platform
huntpdf-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.9 kB

Release files / huntpdf-1.0.0.tar.gz

Download URL huntpdf-1.0.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ba346e7694f546ecc4831b9ea290aa845d53c605c813a55c3333920eb9376b6a
BLAKE2b-256 checksum
How to use checksums
832cd2fb171db9f1d9ebcf790f72028ebf0e2a222f15637633a49b0e58915dd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / huntpdf-1.0.0-py3-none-any.whl

Download URL huntpdf-1.0.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d24a68f3ad2d1fa169279a3bfb5b9b7c684495f7cf991a4d01432fbb2366c00e
BLAKE2b-256 checksum
How to use checksums
2e3a124483a58423641d828f3d724afbcf2aa8fcf800bb396608f04fd592f63a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Security for huntpdf 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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