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.
  • Uses pdftotext (Poppler) to read the first two pages of each PDF.
  • Detects DOI strings with a robust regular expression.
  • Falls back to the first few non‑empty lines as a title when no DOI is found.
  • Command‑line interface with --dir and --output options.
  • Zero external Python dependencies (standard library only).

📦 Installation

From PyPI (recommended)

pip install bib-extractor

From source

  1. Install Popplerpdftotext is required.
  2. 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

Extract DOIs / titles

# Using the installed command (if installed via pip)
bib-extractor --dir path/to/papers --output paper_info.json

# Or run the script directly from the source checkout
python extract_bib_info.py --dir path/to/papers --output paper_info.json
  • --dir defaults to the current working directory.
  • --output defaults to paper_info.json.

Fetch BibTeX entries & Auto-Rename

# Fetch entries and automatically rename your PDFs
bib-fetch --input paper_info.json --output papers.bib --rename --dir path/to/papers
  • --input: The JSON file from the extractor.
  • --output: The destination .bib file.
  • --rename: (Optional) Automatically renames the files in --dir to a standard format: Year - Author - Title.pdf.
  • --dir: (Required if renaming) The folder where your original PDFs are located.

The extractor prints progress and writes a JSON array like:

[
  {"file": "1.pdf", "doi": "10.1109/XYZ.2023.123456"},
  {"file": "2.pdf", "title": "An Interesting Study on …"}
]

Next steps

  • Convert the generated .bib file to the citation style you need.
  • Extend the workflow with additional scripts or integrate into your bibliography manager.

🤝 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.1.tar.gz (6.9 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.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bib_extractor-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for bib_extractor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d91847fd583f021ff9099c4e056edf6f172eb42353ca689720f8c468d7abc12d
MD5 5027272a8f1c8ce08d21a7f9aecb41e5
BLAKE2b-256 26cda5eac103c0ac887700dadee059d1455ab5b8033b3b1cd38c5dd4ba8bcf70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bib_extractor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for bib_extractor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a805fe74ffc00b5b2a232301ca7c6e3b4d0669cbeda669b019498b5c278e092e
MD5 029a9d97c8607e363ee94b6cb4fa5102
BLAKE2b-256 8c641ca01726c525ef3428593a98c16e5a71a449c7ab6e3645f9ddb6d65e711c

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