Resolve DOIs and search queries into formatted BibTeX entries.
Project description
fetchbib
A command-line tool to resolve DOIs and free-text search queries into formatted BibTeX entries. Powered by doi.org and the Crossref API.
Installation
pip
pip install fetchbib
uv
uv tool install fetchbib
Requires Python 3.9+.
Quick start
Fetch BibTeX by DOI (bare or full URL):
fbib 10.1073/pnas.2322823121
fbib https://doi.org/10.1073/pnas.2322823121
@article{DeVerna_2024,
author = {DeVerna, Matthew R. and Yan, Harry Yaojun and Yang, Kai-Cheng and Menczer, Filippo},
DOI = {10.1073/pnas.2322823121},
ISSN = {1091-6490},
journal = {Proceedings of the National Academy of Sciences},
month = dec,
number = {50},
publisher = {Proceedings of the National Academy of Sciences},
title = {Fact-checking information from large language models can decrease headline discernment},
url = {http://dx.doi.org/10.1073/pnas.2322823121},
volume = {121},
year = {2024}
}
Search by free text by including text between quotes:
fbib "DeVerna Fact-checking information from large language models"
Note: Search works best with full paper titles (or partial titles with an author last name). Use
-nto return multiple results if needed. See Specify number of free-text matches section below.
Usage
fbib [-h] [-f FILE] [-o OUTPUT] [-a] [-n MAX_RESULTS] [--config-email EMAIL]
[inputs ...]
Flexible input
fbib accepts DOIs in any format — bare, full URL, or free-text search queries — and you can mix them freely.
Inputs are comma-separated, so all of the following work:
# Multiple positional arguments
fbib 10.1609/icwsm.v5i1.14126 10.1093/jcmc/zmz022
# Comma-separated string
fbib "10.1609/icwsm.v5i1.14126, 10.1093/jcmc/zmz022"
# Full DOI URLs
fbib "https://doi.org/10.1609/icwsm.v5i1.14126, https://doi.org/10.1093/jcmc/zmz022"
# Mix DOIs, URLs, and search queries
fbib 10.1609/icwsm.v5i1.14126 "DeVerna Fact-checking information from large language models"
From a file (--file), each line is treated the same way — one entry per line, or comma-separated on a single line:
fbib --file dois.txt
Duplicate inputs are automatically removed.
Write to a file
Overwrite (default):
fbib --output refs.bib 10.1609/icwsm.v5i1.14126
Append to an existing .bib file:
fbib --append --output refs.bib 10.1093/jcmc/zmz022
Specify number of free-text matches
Free-text searches return 1 result by default. Use -n to control the limit (1-100):
# Get 3 results (see the correct result in position #2)
fbib -n 3 "Fact-checking information from large language models can decrease"
Configure email (optional)
Crossref gives better rate limits to requests that include a contact email. Set yours once and it will be used for all future requests:
fbib --config-email you@example.com
The email is stored in ~/.config/fetchbib/config.json. If not set, a default placeholder is used.
Development
Clone the repo and sync dependencies with uv:
git clone https://github.com/mr-devs/fetchbib.git
cd fetchbib
uv tool install -e . # OR pip install -e .
The
-eflag (uv tool install -e .), it performs an editable installation. This means any changes you make to the local source code are immediately reflected when you run the command, without needing to reinstall.
Run unit tests:
uv run pytest
Run integration tests (hits live APIs):
uv run pytest -m integration
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
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 fetchbib-0.3.0.tar.gz.
File metadata
- Download URL: fetchbib-0.3.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e6219f3975922ec4636944dff0d3c86e38ce9a6f98fd2f8aeb454357165cc2
|
|
| MD5 |
d06b4b6d739995d0df153c05d8a62eec
|
|
| BLAKE2b-256 |
ef704bd211c3f43c34324b3d82f4f4ddfe6166a757bd15080b1ca4b4908d925c
|
File details
Details for the file fetchbib-0.3.0-py3-none-any.whl.
File metadata
- Download URL: fetchbib-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1134c280bcdeae3351554b987f507d2c332140e9383f842c04c3cb13c9e88ed
|
|
| MD5 |
27751bf4b6204dc2e17f3d96a9db4f51
|
|
| BLAKE2b-256 |
c507dd87de9a675a7fa2f9f8e7e1752f79a6a1b14afbcffdec23c3fc5b8e5978
|