A minimal Python script to shorten DOIs in bibtex files using https://shortdoi.org/. The shortener is offered by the International DOI Foundation.
Use it with (or follow long instructions below)
curl -s https://raw.githubusercontent.com/domoritz/shorty/master/main.py | python /dev/stdin long.bib > short.bib
It converts
@article{Moritz2017,
doi = {10.1145/3025453.3025456},
year = {2017},
publisher = {{ACM} Press},
author = {Dominik Moritz and Danyel Fisher and Bolin Ding and Chi Wang},
title = {Trust, but Verify: Optimistic Visualizations of Approximate Queries for Exploring Big Data},
booktitle = {Proceedings of the 2017 {CHI} Conference on Human Factors in Computing Systems - {CHI} {\textquotesingle}17}
}
to (notice the shorter DOI!)
@article{Moritz2017,
doi = {10/b7jt},
year = {2017},
publisher = {{ACM} Press},
author = {Dominik Moritz and Danyel Fisher and Bolin Ding and Chi Wang},
title = {Trust, but Verify: Optimistic Visualizations of Approximate Queries for Exploring Big Data},
booktitle = {Proceedings of the 2017 {CHI} Conference on Human Factors in Computing Systems - {CHI} {\textquotesingle}17}
}
You may have a page limit or you just want your references to be shorter to fit on a single (or two, or three, or n) page.
Download the script. Then copy your bibtex file to a new file (here demo.bib
but you can call it long.bib
). Then run
python main.py demo.bib > short.bib
Alternatively, you can pipe in the the content
cat demo.bib | python main.py > short.bib