How to convert a DOI to a BibTeX file
DOI (Digital Object Identifier) are permanent identifiers for documents such as academic papers. A convenient way to quickly store a bibliography is to keep a list of DOI. Then there exist some web services to convert a DOI link to a bib file. For example, you can copy-paste your DOI on the website doi2bib.org. If you want to download the bib file from a script or a program, the website provides an API. Simply query the URL:
http://www.doi2bib.org/doi2bib?id=<DOI>
by replacing <DOI>
by the corresponding DOI and the output will be a file in bib format.
For instance, for http://www.doi2bib.org/doi2bib?id=10.1007/978-1-4684-2001-2_9
, the output should be:
@incollection{Karp_1972,
doi = {10.1007/978-1-4684-2001-2_9},
url = {https://doi.org/10.1007%2F978-1-4684-2001-2_9},
year = 1972,
publisher = {Springer {US}},
pages = {85--103},
author = {Richard M. Karp},
title = {Reducibility among Combinatorial Problems},
booktitle = {Complexity of Computer Computations}
}
The website doi.org also provides such an API. Assuming that the DOI is stored in the variable $doi
, you can call the API from the Linux shell as follows:
Or, if you prefer cURL
:
I have written the following script to generate a bib file from one DOI or a list of DOIs.
#!/bin/sh
if
then input=""
else input=" "
fi
for
do
doi=
done
Assume that you saved the script in the file doi2bib.sh
, it can be called as follows:
Or, using a pipe, for example:
|
If you only need a citation in plain text format with the formatting style of your choice, the website citation.crosscite.org should fit your needs. The website doi.org also provides this service as an API:
where $doi
is the DOI and $style
is the formatting style (apa
, elsevier-harvard
, …).