Skip to content

Instantly share code, notes, and snippets.

@xjia1
Created January 21, 2014 01:07
Show Gist options
  • Save xjia1/8532489 to your computer and use it in GitHub Desktop.
Save xjia1/8532489 to your computer and use it in GitHub Desktop.
Search Authors on Google Scholar
import re
import urllib2
def get(url):
return urllib2.urlopen(url).read()
def search_author(name):
name = re.sub(r'\s+', '+', name)
page = get('http://scholar.google.com/citations?view_op=search_authors&mauthors=' + name)
m = re.search(r'(?<=/citations\?user=)\w+', page)
user = m.group(0)
page = get('http://scholar.google.com/citations?user=' + user)
m = re.findall(r'(?<=cit-data">)\d+', page)
if len(m) >= 6:
return {'citations': int(m[0]),
'citations since 2009': int(m[1]),
'h-index': int(m[2]),
'h-index since 2009': int(m[3]),
'i10-index': int(m[4]),
'i10-index since 2009': int(m[5])}
else:
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment