Last active
May 13, 2017 13:55
-
-
Save smarr/9093f82f09572a66b561534333f3db42 to your computer and use it in GitHub Desktop.
Download missing bib entries from Bibsonomy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import re | |
import requests | |
bibkey_re = re.compile("Warning--I didn't find a database entry for \"(.*?)\"") | |
with open("paper.blg") as f: | |
content = f.readlines() | |
for line in content: | |
m = bibkey_re.match(line) | |
if m: | |
print("Download: https://www.bibsonomy.org/bib/bibtexkey/" + m.group(1) + "/gron") | |
bibentry = requests.get("https://www.bibsonomy.org/bib/bibtexkey/" + m.group(1) + "/gron") | |
with open("bibsonomy.bib", "a") as bib_file: | |
bib_file.write(bibentry.content + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment