/article-filename

A simple python program to obtain an article filename from its PubMed link.

Primary LanguagePython

article-filename.py

This is a simple program that takes a PubMed link and produces a filename as output. This filename is formatted as follows:

If there is only one author the filename is lastname_year_article title.pdf

Example:

Feynman_1974_Structure of the proton.pdf

If there are two authors the filename is lastname1&lastname2_year_article title.pdf

Example:

Watson&Crick_1953_Molecular structure of nucleic acids; a structure for deoxyribose nucleic acid.pdf

If there are more than two authors the filename is lastname-et-al_year_article title.pdf

Example:

Cowan-et-al_1956_Detection of the Free Neutrino: a Confirmation.pdf

Dependencies

This program is written in Python3 and depends on the following packages:

  • bs4
  • pyperclip
  • requests

You can install them with:

$ pip install beautifulsoup4
$ pip install pyperclip
$ pip install requests

If you are using Linux, you will need to install an additional package in order to get pyperclip working. To install this package just run the following line:

$ sudo apt install xclip

Usage

Usage is very simple, you just have to provide a PubMed URL, for example:

./article-filename.py https://pubmed.ncbi.nlm.nih.gov/17774518/

The program will print the article filename to the stdout and will send it to the clipboard so you can paste it inmediately.