Skip to content

Instantly share code, notes, and snippets.

@wuyongzheng
Created May 10, 2011 16:27
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 wuyongzheng/964820 to your computer and use it in GitHub Desktop.
Save wuyongzheng/964820 to your computer and use it in GitHub Desktop.
search bibtex entries online
#!/bin/bash
if [ $# -eq 0 ] ; then
echo usage $0 '"Visualizing windows system traces"'
exit
fi
query=`urlencode "$1"`
echo liinwww.ira.uka.de:
url1=`wget -O - -q -U 'Mozilla/5.0' "http://liinwww.ira.uka.de/csbib?query=$query" | grep td.class..biblinks | head -n 1 | sed -e 's/" title="Full.*//g' -e 's/.*"//g' -e 's/amp;//g'`
if ! echo "$url1" | grep -q '^/cgi-bin/.*intra$' ; then
echo unknown csbib result: $url1
exit
fi
wget -O - -q -U 'Mozilla/5.0' "http://liinwww.ira.uka.de$url1" | binreplace -r '\n' 'ATPNL' | sed -e 's/.*<pre class="bibtex">//g' -e 's/<.pre>.*//g' -e 's/<[^<>]*>//g' | binreplace -r 'ATPNL' '\n'
echo Faceted DBLP:
url1=`wget -O - -q "http://dblp.l3s.de/?q=$query&search_opt=all&newQuery=yes&resTableName=query_resultXnC5ya&synt_query_exp=full" | grep '>BibTeX</a>' | head -n 1 | sed -e 's/BibTeX<.*//g' -e 's/.*a href=.//g' -e 's/".*//g'`
if ! echo "$url1" | grep -q '^http:' ; then
echo unknown Faceted result: $url1
exit
fi
wget -O - -q "$url1" | binreplace -r '\n' 'ATPNL' -r '<pre>' '\n<pre>' -r '</pre>' '</pre>\n' | grep '<pre>' | binreplace -r 'ATPNL' '\n' -d '<pre>' -d '</pre>' | sed -e 's/<[^<>]*>//g'
echo Google Scholar:
rm -f /tmp/sbibtex1.html /tmp/sbibtex-cookie1.txt /tmp/sbibtex-cookie2.txt
wget -q -O /tmp/sbibtex1.html --keep-session-cookies --save-cookies=/tmp/sbibtex-cookie1.txt -U Mozilla/5.0 "http://scholar.google.com.sg/scholar_preferences?q=$query&hl=en"
scisig=`grep type.hidden.name.scisig /tmp/sbibtex1.html | sed -e 's/.*scisig value=.//g' -e 's/".*//g'`
inst=`grep name=.inst..type= /tmp/sbibtex1.html | sed -e 's/.*name="inst" type="checkbox" value="//g' -e 's/".*//g'`
if [ -z "$scisig" ] ; then
echo unknown scisig
exit
fi
url1=`wget -q -O - --keep-session-cookies --load-cookies=/tmp/sbibtex-cookie1.txt --save-cookies=/tmp/sbibtex-cookie2.txt -U Mozilla/5.0 "http://scholar.google.com.sg/scholar_setprefs?q=$query&scisig=$scisig&inststart=0&hl=en&lang=all&as_sdt=1%2c5&as_sdtp=on&instq=&inst=$inst&num=10&scis=yes&scisf=4&submit=Save%20Preferences" | grep 'Import into BibTeX' | head -n 1 | sed -e 's/">Import into BibTeX.*//g' -e 's/.*"//g' -e 's/amp;//g'`
if ! echo "$url1" | grep -q '^/scholar.bib' ; then
echo unknown scholar.bib: $url1
exit
fi
wget -q -O - --keep-session-cookies --load-cookies=/tmp/sbibtex-cookie2.txt -U Mozilla/5.0 "http://scholar.google.com.sg$url1"
echo CiteSeerX:
url1=`wget -q -O - "http://citeseerx.ist.psu.edu/search?q=$query&sort=rel" | grep href=./viewdoc/summary | head -n 1 | sed -e 's/.*href="//g' -e 's/".*//g'`
if ! echo "$url1" | grep -q '^/viewdoc' ; then
echo unknown url1: $url1
exit
fi
wget -q -O - "http://citeseerx.ist.psu.edu$url1" | grep '^ *@' | sed -e 's/^ *//g' | binreplace -r '<br/>' '\n' -r '&nbsp;' ' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment