Skip to main content

pubid2bib

pubid2bib (Publication Identifier to BibTeX) is a command line tool to fetch bibliographic entries for given publication identifiers using online services offered by PubMed, DOI and Google.

Usage:

pubid2bib publicationId1 publicationId2 ... publicationIdN

Where publicationIds are well formed PMIDs or DOIs for scientific papers or ISBNs for books.

Example:

pubid2bib 31726262 10.1021/acs.jced.5b00684 0735619670

Will create three BibTeX files in the current path, named:

  • "Removal of dental alloys and titanium attenuates trace metals and biological effects on liver and kidney.bib"
  • "Thermodynamic Properties of R-227ea, R-365mfc, R-115, and R-13I1.bib"
  • "Code Complete.bib"

The filenames will be the publication's titles and the bibliographic entries will conform to Bibtex @article and @book formats.

Install

pubid2bib is a standalone Python script. You need Python 3 installed and you need to be able to execute Python scripts on your platform.

Inspiration

The fantastic web service TexMed allows to search scientific articles in PubMed and create BibTex bibliographic entries for them. This was the inspiration for pubid2bib.

In one sense, pubid2bib is more limited, it needs you to find the publication identifiers first, to create the BibTex entries. But, it is more general in another sense, because you can use DOIs for published scientific articles that are not found in PubMed and also ISBNs for books. Furthermore, pubid2bib can be called from scripts.

Scripting

From bash

Asumming you have a file called publications.txt with publication identifiers in each line, e.g.:

38942015
38917788
38935715

You can have a bash script that calls pubid2bib for each identifier:

#!/bin/bash

input="publications.txt"

while read -r pmid
do
    echo "${pmid}"
    pubid2bib "${pmid}"
done < "$input"

From Python

You can use the function dispatch for each identifier

#!/usr/bin/env python


if __name__ == '__main__':
    from pubid2bib import dispatch
    with open('publications.txt', 'r') as file_object:
        try:
            paperIds = file_object.readlines()
            for pid in paperIds:
                print(pid[:-1])
                dispatch(pid[:-1])
        except (IOError, OSError):
            print('Error reading file')

Abbreviations

PMID: PubMed identifier

DOI: Digital Object Identifier

ISBN: International Standard Book Number

Metadata

Release files for pubid2bib 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pubid2bib 0.0.1
File Size Uploaded
pubid2bib-0.0.1.tar.gz 47.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pubid2bib 0.0.1
File Interpreter ABI Platform
pubid2bib-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 95.1 kB

Release files / pubid2bib-0.0.1.tar.gz

Download URL pubid2bib-0.0.1.tar.gz
Size 47.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fa48e72a93be338ef494731fe875fe33e4a6812048789e5ea08dde33176f17c1
BLAKE2b-256 checksum
How to use checksums
86a49f584fb66ab043d79f12852686db9ed078a383c3aa34d8209b2d9ff71d83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / pubid2bib-0.0.1-py3-none-any.whl

Download URL pubid2bib-0.0.1-py3-none-any.whl
Size 47.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf608d7019484d66981dc6fe98136d5a2b65f482a394c8e528b53b84b729c43b
BLAKE2b-256 checksum
How to use checksums
613544ef4364e6b4248974a97739e7ce7bed8c355ead40d3964f1ead1907ab63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page