Created
January 21, 2014 01:07
-
-
Save xjia1/8532489 to your computer and use it in GitHub Desktop.
Search Authors on Google Scholar
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
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