Skip to content

Commit 389082b

Browse files
committed
Update scholar_id upon fetching the page
1 parent 630d12c commit 389082b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scholarly/author_parser.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,14 @@ def fill(self, author, sections: list = [], sortby="citedby", publication_limit:
440440
url = '{0}&pagesize={1}'.format(url_citations, _PAGESIZE)
441441
soup = self.nav._get_soup(url)
442442

443+
# Update scholar_id
444+
scholar_id = re.findall(_CITATIONAUTHRE, soup.find("link", rel="canonical").get('href', ""))[0]
445+
if scholar_id != author['scholar_id']:
446+
self.nav.logger.warning("Changing the scholar_id following redirect from %s to %s. "
447+
"To avoid this warning, use %s to look up this scholar.",
448+
author['scholar_id'], scholar_id, scholar_id)
449+
author["scholar_id"] = scholar_id
450+
443451
if sections == []:
444452
for i in self._sections:
445453
if i not in author['filled']:

0 commit comments

Comments
 (0)