Skip to content

Commit 5a328d4

Browse files
author
Matt Sinclair
committed
Now works for names with homonyms. E.g., Abdul Sattar 0001. Though it
kills the purpose of loading data lazily. Cherry-picked from: scholrly#6
1 parent ce6c853 commit 5a328d4

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

dblp/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,14 @@ def search(author_str):
144144
resp = requests.get(DBLP_AUTHOR_SEARCH_URL, params={'xauthor':author_str})
145145
#TODO error handling
146146
root = etree.fromstring(resp.content)
147-
return [Author(urlpt) for urlpt in root.xpath('/authors/author/@urlpt')]
147+
arr_of_authors = []
148+
for urlpt in root.xpath('/authors/author/@urlpt'):
149+
resp1 = requests.get(DBLP_PERSON_URL.format(urlpt=urlpt))
150+
xml = resp1.content
151+
root1 = etree.fromstring(xml)
152+
if root1.xpath('/dblpperson/homonym/text()'):
153+
for hom_urlpt in root1.xpath('/dblpperson/homonym/text()'):
154+
arr_of_authors.append(Author(hom_urlpt))
155+
else:
156+
arr_of_authors.append(Author(urlpt))
157+
return arr_of_authors

0 commit comments

Comments
 (0)