scholarly-python-package / scholarly

Retrieve author and publication information from Google Scholar in a friendly, Pythonic way without having to worry about CAPTCHAs!
https://scholarly.readthedocs.io/
The Unlicense
1.29k stars 292 forks source link

StopIteration on search query with DOI (was working a month ago) #510

Open kostrykin opened 11 months ago

kostrykin commented 11 months ago

Describe the bug I get a StopIteration error immediately after calling next on a search query which contains a DOI. The same code has been working for many months, but stopped working suddenly. It appears that scholarly fails to find (or parse?) the document. The DOI used seems negligible (I have tried several others and all yield the same behavior).

To Reproduce

from scholarly import scholarly, ProxyGenerator

search_query = scholarly.search_pubs('10.1007/978-3-031-09037-0_20')
pub = next(search_query)
print(pub['num_citations'])

Expected behavior The code should run through without errors being raised (and a 0 should be printed).

Desktop (please complete the following information):

Do you plan on contributing? Your response below will clarify whether the maintainers can expect you to fix the bug you reported.

Additional context I have tried this with scholarly 1.7.9 and 1.7.11, installed via pip.

ronny3 commented 10 months ago

Probably the same as #508 . Google Scholar have a new class in the UI for when there is a single result. I posted a simple patch while waiting for better fix.

kostrykin commented 10 months ago

The workaround mentioned in #508 indeed works.