Skip to main content

Extract DOIs or titles from PDF papers and generate a BibTeX bibliography

Project description

Bib Extractor

PyPI version License: MIT

A tiny, pip‑installable Python utility that scans a folder of PDF papers, extracts their DOI (or a title fallback), and produces a JSON file that can be turned into a BibTeX bibliography.


✨ Features

  • Works on any folder of PDFs.
  • Pure Python: No external tools like Poppler or pdftotext required.
  • Detects DOI strings with a robust regular expression.
  • Multiple API Support: Queries doi.org and falls back to Crossref for metadata.
  • Auto-Rename: Automatically renames PDFs to Year - Author - Title.pdf.
  • Formatted Citations: Generates APA/MLA/IEEE style reference lists in a separate text file.
  • Visual Progress: Includes a terminal progress bar for high‑volume processing.

📦 Installation

From PyPI (recommended)

pip install bib-extractor

From source

  1. Clone the repository
git clone https://github.com/msrtarit/bib_extractor.git
cd bib_extractor
  1. (Optional) Create a virtual environment and install the package in editable mode:
python -m venv .venv
.venv\\Scripts\\activate   # Windows
# or source .venv/bin/activate on Unix
pip install -e .

🚀 Usage

1. Extract DOIs / Titles

This step scans your PDFs and creates a metadata JSON.

Standard Command:

bib-extractor --dir path/to/papers --output paper_info.json

Windows / Path Fallback: If the command above says "not found", use the Python module directly:

python -m bib_extractor --dir path/to/papers --output paper_info.json

2. Fetch BibTeX & Auto-Rename

This step uses the JSON from step 1 to download metadata and (optionally) rename files.

Standard Command:

bib-fetch --input paper_info.json --output papers.bib --rename --dir path/to/papers

Windows / Path Fallback:

python -m bib_extractor.fetch_bibtex --input paper_info.json --output papers.bib --rename --dir path/to/papers

[!TIP] Windows Users: If the short commands (bib-extractor) don't work, ensure your Python Scripts folder is added to your system environment variables. Alternatively, always use the python -m method shown above.

🛠️ Options & Arguments

Flag Description Default
--dir Directory containing PDF files (or where to rename) Current Dir
--output Path to save the BibTeX .bib file paper_info.json
--input The JSON metadata file from Step 1 Required for Step 2
--citations Output file for a formatted reference list (e.g. refs.txt) Optional
--style Citation style for the reference list (apa, mla, or ieee) apa
--rename Automatically rename PDFs to Year - Author - Title.pdf Optional

🤝 Contributing

Please see the CONTRIBUTING.md for guidelines on how to fork the repo, set up a development environment, and submit pull requests.


📜 License

This project is licensed under the MIT License – see the LICENSE file for details.

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

bib_extractor-0.1.7.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

bib_extractor-0.1.7.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file bib_extractor-0.1.7.1.tar.gz.

File metadata

  • Download URL: bib_extractor-0.1.7.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bib_extractor-0.1.7.1.tar.gz
Algorithm Hash digest
SHA256 f62e8f7bf7b66357b57c8310cfca82efa61c77079d641703b0d1188aed108ca8
MD5 173a9ce8af5dcb0329dca6d64f3fbf1a
BLAKE2b-256 46a354b4fd77c8f0b91df7101188998d779e8b9cd3e31980b393fcaf6a6e345a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bib_extractor-0.1.7.1.tar.gz:

Publisher: publish.yml on msrtarit/bib-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bib_extractor-0.1.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bib_extractor-0.1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 22ec845746b1219e4362bf0e208f34f4286377afb78474cc44828aa4f3ba839b
MD5 7fef4cc978682ca5ad190c1d6cc875fb
BLAKE2b-256 78526778188950b1f555897937cbf132e82b7af96bfe54dc7388aa1c6a779fe5

See more details on using hashes here.

Provenance

The following attestation bundles were made for bib_extractor-0.1.7.1-py3-none-any.whl:

Publisher: publish.yml on msrtarit/bib-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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