Extract DOIs or titles from PDF papers and generate a BibTeX bibliography
Project description
Bib Extractor
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
--dirand--outputoptions. - Zero external Python dependencies (standard library only).
📦 Installation
From PyPI (recommended)
pip install bib-extractor
From source
- Install Poppler –
pdftotextis required.- Windows: download from https://github.com/oschwartz10612/poppler-windows/releases and add the
binfolder to yourPATH. - macOS:
brew install poppler - Linux:
sudo apt-get install poppler-utils
- Windows: download from https://github.com/oschwartz10612/poppler-windows/releases and add the
- Clone the repository
git clone https://github.com/msrtarit/bib_extractor.git
cd bib_extractor
- (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
--dirdefaults to the current working directory.--outputdefaults topaper_info.json.
Fetch BibTeX entries
# From the repository root (or after installing via pip)
python fetch_bibtex.py --input paper_info.json --output papers.bib
The script reads the JSON produced by the extractor, fetches BibTeX records for entries that have a DOI, and writes them to papers.bib.
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
.bibfile 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bib_extractor-0.1.0.tar.gz.
File metadata
- Download URL: bib_extractor-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ac54d4008a453fd5fd096e928a7c6c83f6200951aa4f4c4a13a7b83efbde5de
|
|
| MD5 |
d9571ffcf486f3e1b88be2113fb22475
|
|
| BLAKE2b-256 |
8544315fcd5fba878002dbf650cb186c434b2759fe4778ca3b8e16cc5a50c236
|
File details
Details for the file bib_extractor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bib_extractor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce90b22286594f9844d7e56473a23c7ecc85c109d3d504cb63c507f852d535fc
|
|
| MD5 |
232f86d2390e07f4ef5e3a0c57348245
|
|
| BLAKE2b-256 |
a6e1e19edd623caf3922bf2fbddc6d777a7b5e4ae23071890faac6e79bcfc22c
|