Skip to content

Commit

Permalink
now using ADS Bumblebee
Browse files Browse the repository at this point in the history
  • Loading branch information
dgerosa committed Nov 9, 2019
1 parent bd2d702 commit b87fae4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion example/clean.sh

This file was deleted.

10 changes: 6 additions & 4 deletions fillbib.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@


def ads_citation(c): # download single ADS citation
#f= urllib.urlopen("http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode="+c+"&data_type=BIBTEX&db_key=AST&nocookieset=1")
#print("http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode="+c+"&data_type=BIBTEX&db_key=AST&nocookieset=1")
f= urllib.urlopen("https://ui.adsabs.harvard.edu/abs/"+c+"/exportcitation")

f= urllib.urlopen("http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode="+c+"&data_type=BIBTEX&db_key=AST&nocookieset=1")
bib = f.read()
f.close()
if sys.version_info.major>=3:
bib=bib.decode()
bib = "@"+bib.split("@")[1]

bib = "@"+list(filter(lambda x:'adsnote' in x, bib.split("@")))[0].split("</textarea>")[0]
bib=bib.replace("&#34;","")
if 'arXiv' in c: # Take care of preprint on ADS
bib = bib.split("{")[0]+"{"+c+","+",".join(bib.split(",")[1:])
return bib
Expand Down Expand Up @@ -110,7 +112,7 @@ def test_inspire(): # test single INSPIRE web scraping
if c and c not in haves: # c is something and you don't have it already

if not c[0].isalpha(): # The first charachter is a number: could be on ADS

try:
bib = ads_citation(c)
bibtex.write(bib)
Expand Down
2 changes: 1 addition & 1 deletion filltex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Davide Gerosa

# Install texshop engine
if [ $1 == 'install-texshop' ]; then
if [[ $1 = 'install-texshop' ]]; then
TEXSHOP="${HOME}/Library/TeXshop/Engines/filltex.engine"
echo "Installing texshop engine in $TEXSHOP"
echo ''#!/bin/bash '' > $TEXSHOP
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.core import setup

setup(name = 'filltex',
version = '1.2',
version = '1.3',
description = 'Automatic queries to ADS and InSPIRE databases to fill LATEX bibliography',
long_description="See: `github.com/dgerosa/filltex <https://github.com/dgerosa/filltex>`_." ,
author = 'Davide Gerosa and Michele Vallisneri',
Expand Down

0 comments on commit b87fae4

Please sign in to comment.