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

Retrieving cites_per_year from PUBLICATION_SEARCH_SNIPPET #494

Closed ianfoster closed 1 year ago

ianfoster commented 1 year ago

I want to find citations per year for a specified title. I can get a publication object for a title as follows:

bf = scholarly.search_single_pub('Benchmarking GPUs to tune dense linear algebra',True)

But then I am not sure how to retrieve the citations per year. I know how to do that for a AUTHOR_PUBLICATION_ENTRY, but this search retrieves a PUBLICATION_SEARCH_SNIPPET, which does not contain "cites_per_year". Is there a way to get from a PUBLICATION_SEARCH_SNIPPET to an AUTHOR_PUBLICATION_ENTRY?

I know that I can do this:

    pub = scholarly.search_single_pub(title)
    citations = scholarly.citedby(pub)
    pubs = [p for p in citations] 
    py = [pp['bib']['pub_year'] for pp in pubs]
    cites_by_year = collections.Counter(py)

But that seems to be very slow (and therefore times out).