articledownloader.articledownloader module

class articledownloader.articledownloader.ArticleDownloader(els_api_key=None, crf_api_key=None, timeout_sec=30)[source]
check_els_entitlement(*args, **keywords)[source]

Checks entitlement for fulltext downloads on Elsevier’s API

Parameters:doi (str) – Document Object Identifier (DOI) for the paper we are checking
Return type:bool
Returns:Whether or not we can download the article (True = Yes, No = False)
get_abstract_from_doi(*args, **keywords)[source]

Returns abstract as a unicode string given a DOI

Parameters:
  • doi (str) – DOI string for the article we want to grab metadata for
  • mode (str) – Only supports ‘elsevier’ for now
Returns:

An abstract (or None on failure)

Return type:

unicode

get_dois_from_journal_issn(*args, **keywords)[source]

Grabs a set of unique DOIs based on a journal ISSN using the CrossRef API

Parameters:
  • issn (str) – The ISSN of the journal
  • rows (int) – the maximum number of DOIs to find
  • pub_after (int) – the minimum publication year for DOIs returned
Returns:

the unique set of DOIs as a list

Return type:

list

Grabs a set of unique DOIs based on a search query using the CrossRef API

Parameters:
  • query (str) – the search string
  • rows (int) – the maximum number of DOIs to find
Returns:

the unique set of DOIs as a list

Return type:

list

get_html_from_doi(*args, **keywords)[source]

Downloads and writes an HTML article to a file, given a DOI and operating mode

Parameters:
  • doi (str) – DOI string for the article we want to download
  • writefile (file) – file object to write to
  • mode (str) – either ‘elsevier’ | ‘springer’ | ‘acs’ | ‘ecs’ | ‘rsc’ | ‘nature’ | ‘wiley’ | ‘aaas’, depending on how we wish to access the file
Returns:

True on successful write, False otherwise

Return type:

bool

get_pdf_from_doi(*args, **keywords)[source]

Downloads and writes a PDF article to a file, given a DOI and operating mode

Parameters:
  • doi (str) – DOI string for the article we want to download
  • writefile (file) – file object to write to
  • mode (str) – either ‘crossref’ | ‘elsevier’ | ‘rsc’ | ‘springer’ | ‘ecs’ | ‘nature’ | ‘acs’, depending on how we wish to access the file
Returns:

True on successful write, False otherwise

Return type:

bool

get_title_from_doi(*args, **keywords)[source]

Returns title of an article as a unicode string given a DOI

Parameters:
  • doi (str) – DOI string for the article we want to grab metadata for
  • mode (str) – Only supports ‘crossref’ for now
Returns:

An abstract (or None on failure)

Return type:

unicode

load_queries_from_csv(*args, **keywords)[source]

Loads a list of queries from a CSV file

Parameters:csvf (file) – file object containing a CSV file with one query per line
Returns:a list of queries, processed to be insertable into REST API (GET) calls
Return type:list