Skip to main content

wiki-paper-refs

CLI that takes a Wikipedia article URL and prints academic paper references. Each item includes:

Field Meaning
reference_id Wikipedia <ref name="..."> when present, otherwise DOI / PMID / arXiv id
reference_text Human-readable citation from the cite template
wikipedia_added ISO timestamp of the first revision that contains this paper's identifier
paper_published Earliest publication date from Crossref, PubMed, or arXiv
doi, pmid, pmc, arxiv_id Identifiers when known
work_type Publisher type (for example journal-article, posted-content)

News, web pages, and most books are skipped. A reference is kept if it has a DOI, PMID, PMC, or arXiv id and looks like a paper or preprint.

Requires Python 3.10+. Talks to the Wikipedia API plus Crossref, PubMed, and arXiv (no API keys).

Install

pip install wiki-paper-refs

That installs the wiki-paper-refs command. Then:

wiki-paper-refs --help

From a clone (the GitHub repo is currently private):

git clone https://github.com/Amannor/wiki-paper-refs.git
cd wiki-paper-refs
python3 -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pytest

Usage

wiki-paper-refs "https://en.wikipedia.org/wiki/CRISPR"
wiki-paper-refs "https://en.wikipedia.org/wiki/Okazaki_fragments" --format table
wiki-paper-refs "https://en.wikipedia.org/wiki/CRISPR" -o refs.json
wiki-paper-refs --help
Option Description
-f, --format json (default), table, or csv
-o, --output Write to a file instead of stdout
--skip-history Do not look up when each reference was first added (much faster)
--skip-published Do not look up publisher dates
--mailto Contact email for Crossref's polite pool (or set CROSSREF_MAILTO)

JSON is meant for piping into other tools. --skip-history is the right default while you iterate; full history walks every article's revisions and can take a long time on large pages.

If the page has no academic paper citations, the command prints a message on stderr, writes an empty list, and exits with code 2.

Library usage

from wiki_paper_refs import collect

refs = collect(
    "https://en.wikipedia.org/wiki/Okazaki_fragments",
    skip_history=True,
)
for ref in refs:
    print(ref.reference_id, ref.paper_published)

How dates are resolved

Wikipedia added date. The tool lists the article's revisions, then binary-searches wikitext for the first revision that contains that paper's DOI (or PMID / arXiv id). That is usually when the citation was added. If the paper was cited first without an identifier and the DOI was filled in later, the timestamp is the identifier addition, not the original footnote.

Publication date. For DOIs, Crossref published-online, published-print, published, and issued are compared and the earliest is used. PMID and arXiv are fallbacks when there is no usable Crossref date.

The User-Agent already identifies this tool to Wikipedia. Set CROSSREF_MAILTO if you run many lookups.

Limitations

  • Only English and other Wikimedia wikis reachable as *.wikipedia.org URLs.
  • Citations without DOI / PMID / PMC / arXiv are omitted, even if they are journal articles.
  • Very large articles (thousands of revisions, hundreds of papers) will be slow unless you pass --skip-history.

License

MIT. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wiki_paper_refs-0.1.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

wiki_paper_refs-0.1.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file wiki_paper_refs-0.1.1.tar.gz.

File metadata

  • Download URL: wiki_paper_refs-0.1.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for wiki_paper_refs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f12f8a41ad5a0281a15eedbf8039111323926d844b561c2af68e35fec701a370
MD5 7fa8037bd75036b3bc1fe550d0b93e34
BLAKE2b-256 6ea926a3787005f86909cc5746e74a027dd48ca31860343ff45a3914ce4eda1b

See more details on using hashes here.

File details

Details for the file wiki_paper_refs-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wiki_paper_refs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for wiki_paper_refs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6883b3cd152f53f5c9663545e9315d5119bf35a3f8fbd7a9ad157a372aee4942
MD5 faf0b59ec677cf5ce36633aaeca0c844
BLAKE2b-256 3a3c216740c22eab5fe7f7c05320472f1cfdb04cb059dad2a5550cf808d001ac

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 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