doi2bib2
doi2bib2 copied to clipboard
Programmatic Access to Website?
I love the website you have set up! 🙂
Is there any way to programatically input a DOI and get the info back from your website to be able to parse?
@davidagraf sorry to bother but wanted to follow up on this.
I am also interested on this. Does anyone know a curl
command that can do the job?
@davidagraf any response yet?
Unfortunately, we had to block programmatic access due to quota/budget limitations.
@YogiOnBioinformatics @adosar
Sorry if I am late to this, but you can achieve this using curl
. Suppose you want to fetch the BibTeX entry for this paper, you just run the following:
$ curl -LH "Accept: application/x-bibtex" https://doi.org/10.1056/NEJMoa2001017
and you get
@article{Zhu_2020, title={A Novel Coronavirus from Patients with Pneumonia in China, 2019}, volume={382}, ISSN={1533-4406}, url={http://dx.doi.org/10.1056/NEJMoa2001017}, DOI={10.1056/nejmoa2001017}, number={8}, journal={New England Journal of Medicine}, publisher={Massachusetts Medical Society}, author={Zhu, Na and Zhang, Dingyu and Wang, Wenling and Li, Xingwang and Yang, Bo and Song, Jingdong and Zhao, Xiang and Huang, Baoying and Shi, Weifeng and Lu, Roujian and Niu, Peihua and Zhan, Faxian and Ma, Xuejun and Wang, Dayan and Xu, Wenbo and Wu, Guizhen and Gao, George F. and Tan, Wenjie}, year={2020}, month=feb, pages={727–733} }
You can read more about DOI Content Negotiation here.
@kakumarabhishek this is brilliant!
Thanks so much!
@YogiOnBioinformatics @adosar
Sorry if I am late to this, but you can achieve this using
curl
. Suppose you want to fetch the BibTeX entry for this paper, you just run the following:$ curl -LH "Accept: application/x-bibtex" https://doi.org/10.1056/NEJMoa2001017
and you get
@article{Zhu_2020, title={A Novel Coronavirus from Patients with Pneumonia in China, 2019}, volume={382}, ISSN={1533-4406}, url={http://dx.doi.org/10.1056/NEJMoa2001017}, DOI={10.1056/nejmoa2001017}, number={8}, journal={New England Journal of Medicine}, publisher={Massachusetts Medical Society}, author={Zhu, Na and Zhang, Dingyu and Wang, Wenling and Li, Xingwang and Yang, Bo and Song, Jingdong and Zhao, Xiang and Huang, Baoying and Shi, Weifeng and Lu, Roujian and Niu, Peihua and Zhan, Faxian and Ma, Xuejun and Wang, Dayan and Xu, Wenbo and Wu, Guizhen and Gao, George F. and Tan, Wenjie}, year={2020}, month=feb, pages={727–733} }
You can read more about DOI Content Negotiation here.
Is it possible to pretty print this? Maybe it is related to this?
@adosar I may be too late to answer, but I managed to get away with a (GNU) sed
one-liner, which you may find helpful.
Building on the example curl command above:
curl --silent -LH "Accept: application/x-bibtex" 'https://doi.org/10.1056/NEJMoa2001017' | sed -E -e 's/}$/\n}/g' -e 's/^\s//g' -e 's/,\s([a-zA-Z]+=)/,\n \1/g'
Which results in the following output:
@article{Zhu_2020,
title={A Novel Coronavirus from Patients with Pneumonia in China, 2019},
volume={382}, ISSN={1533-4406},
url={http://dx.doi.org/10.1056/NEJMoa2001017},
DOI={10.1056/nejmoa2001017},
number={8},
journal={New England Journal of Medicine},
publisher={Massachusetts Medical Society},
author={Zhu, Na and Zhang, Dingyu and Wang, Wenling and Li, Xingwang and Yang, Bo and Song, Jingdong and Zhao, Xiang and Huang, Baoying and Shi, Weifeng and Lu, Roujian and Niu, Peihua and Zhan, Faxian and Ma, Xuejun and Wang, Dayan and Xu, Wenbo and Wu, Guizhen and Gao, George F. and Tan, Wenjie},
year={2020},
month=feb,
pages={727–733}
}
@fbucchini Perfect! I just can't understand why the output formatting changed. Previously there was need to further process the returned string.