Skip to content

Instantly share code, notes, and snippets.

@mattpitkin
Last active June 5, 2019 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpitkin/7834c802be6264634c695cf5dc4a1e7a to your computer and use it in GitHub Desktop.
Save mattpitkin/7834c802be6264634c695cf5dc4a1e7a to your computer and use it in GitHub Desktop.
Get my publication from ADS
import ads
query = 'pubdate:[2003-01 TO 9999-12] author:("Pitkin, M")'
maxpubs = 500
papers = ads.SearchQuery(q=query, rows=maxpubs, property='article')
titleexclusions = ["Erratum", "ERRATUM", "Publisher's Note"]
to_retrieve = set()
for paper in papers:
exclude = False
title = paper.title[0]
for te in titleexclusions:
if te in title:
exclude = True
break
if not exclude:
to_retrieve.add(paper.bibcode)
# get bibtex
bibtexs = ads.ExportQuery(list(to_retrieve), 'bibtex').execute()
# write out bibtex
with open('my_pubs.bib', 'w') as fp:
fp.write(bibtexs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment