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.
- Pure Python: No external tools like Poppler or
pdftotextrequired. - Detects DOI strings with a robust regular expression.
- Multiple API Support: Queries
doi.organd falls back to Crossref for metadata. - Auto-Rename: Automatically renames PDFs to
Year - Author - Title.pdf. - Formatted Citations: Generates APA/MLA 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
- 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
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 PythonScriptsfolder is added to your system environment variables. Alternatively, always use thepython -mmethod 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 or mla) |
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
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.6.tar.gz.
File metadata
- Download URL: bib_extractor-0.1.6.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77466e043324bf5cbbc85c5e864f23481d49dbfbca56cabea62471891d995926
|
|
| MD5 |
ceb2ef0f0ff43678ada947325b8dcc88
|
|
| BLAKE2b-256 |
065b88d772fc5086b76199940319f9cde3956d223a00fefe067bb351cd64eda9
|
Provenance
The following attestation bundles were made for bib_extractor-0.1.6.tar.gz:
Publisher:
publish.yml on msrtarit/bib-extractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bib_extractor-0.1.6.tar.gz -
Subject digest:
77466e043324bf5cbbc85c5e864f23481d49dbfbca56cabea62471891d995926 - Sigstore transparency entry: 1018001186
- Sigstore integration time:
-
Permalink:
msrtarit/bib-extractor@d488cb551b12625aaf13c4fbe6c0e9075d8d772d -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/msrtarit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d488cb551b12625aaf13c4fbe6c0e9075d8d772d -
Trigger Event:
release
-
Statement type:
File details
Details for the file bib_extractor-0.1.6-py3-none-any.whl.
File metadata
- Download URL: bib_extractor-0.1.6-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d5a6c1238a25cf4845a9f9c799d510122f416ce94f6ec2a08ca9ac579e7f3f5
|
|
| MD5 |
c79e72a2ed9bde906bf11d9d43d6a3a8
|
|
| BLAKE2b-256 |
aaef892814b660fa8ea7e592f9a1b2ec12d35151a155d98b743ffccd80d9b734
|
Provenance
The following attestation bundles were made for bib_extractor-0.1.6-py3-none-any.whl:
Publisher:
publish.yml on msrtarit/bib-extractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bib_extractor-0.1.6-py3-none-any.whl -
Subject digest:
2d5a6c1238a25cf4845a9f9c799d510122f416ce94f6ec2a08ca9ac579e7f3f5 - Sigstore transparency entry: 1018001206
- Sigstore integration time:
-
Permalink:
msrtarit/bib-extractor@d488cb551b12625aaf13c4fbe6c0e9075d8d772d -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/msrtarit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d488cb551b12625aaf13c4fbe6c0e9075d8d772d -
Trigger Event:
release
-
Statement type: