Package: scholarly
scholarlyscholarly is a module that allows you to retrieve author and publication information fromGoogle Scholarin a friendly, Pythonic way without having to solve CAPTCHAs.Installationscholarlycan be installed either withcondaor withpip.
To install usingconda, simply runcondainstall-cconda-forgescholarlyAlternatively, usepipto install the latest release from pypi:pip3installscholarlyorpipto install from github:pip3install-Ugit+https://github.com/scholarly-python-package/scholarly.gitWe are constantly developing new features.
Please update your local package regularly.scholarlyfollowsSemantic Versioning.
This means your code that uses an earlier version ofscholarlyis guaranteed to work with newer versions.Optional dependenciesTor:scholarlycomes with a handful of APIs to set up proxies to circumvent anti-bot measures.
Tor methods are deprecated since v1.5 and are not actively tested or supported.
If you wish to use Tor, installscholarlyusing thetortag aspip3installscholarly[tor]If you usezsh(which is now the default in latest macOS), you should type this aspip3installscholarly'[tor]'Note:Tor option is unavailable with conda installation.TestsTo check if your installation is succesful, run the tests by executing thetest_module.pyfile as:python3test_moduleorpython3-munittest-vtest_module.pyDocumentationCheck thedocumentationfor acomplete API referenceand aquickstart guide.Examplesfromscholarlyimportscholarly# Retrieve the author's data, fill-in, and print# Get an iterator for the author resultssearch_query=scholarly.search_author('Steven A Cholewiak')# Retrieve the first result from the iteratorfirst_author_result=next(search_query)scholarly.pprint(first_author_result)# Retrieve all the details for the authorauthor=scholarly.fill(first_author_result)scholarly.pprint(author)# Take a closer look at the first publicationfirst_publication=author['publications'][0]first_publication_filled=scholarly.fill(first_publication)scholarly.pprint(first_publication_filled)# Print the titles of the author's publicationspublication_titles=[pub['bib']['title']forpubinauthor['publications']]print(publication_titles)# Which papers cited that publication?citations=[citation['bib']['title']forcitationinscholarly.citedby(first_publication_filled)]print(citations)IMPORTANT: Making certain types of queries, such asscholarly.citedbyorscholarly.search_pubs, will lead to Google Scholar blocking your requests and may eventually block your IP address.
You must use proxy services to avoid this situation.
See the"Using proxies" sectionin the documentation for more details. Here's a short example:fromscholarlyimportProxyGenerator# Set up a ProxyGenerator object to use free proxies# This needs to be done only once per sessionpg=ProxyGenerator()pg.FreeProxies()scholarly.use_proxy(pg)# Now search Google Scholar from behind a proxysearch_query=scholarly.search_pubs('Perception of physical stability and center of mass of 3D objects')scholarly.pprint(next(search_query))scholarlyalso has APIs that work with several premium (paid) proxy services.scholarlyis smart enough to know which queries need proxies and which do not.
It is therefore recommended to always set up a proxy in the beginning of your application.DisclaimerThe developers useScraperAPIto run the tests in Github Actions.
The developers ofscholarlyare not affiliated with any of the proxy services and do not profit from them. If your favorite service is not supported, please submit an issue or even better, follow it up with a pull request.ContributingWe welcome contributions from you.
Please create an issue, fork this repository and submit a pull request.
Read thecontributing documentfor more information.AcknowledgingscholarlyIf you have used this codebase in a scientific publication, please cite this software as following:@software{cholewiak2021scholarly,author={Cholewiak, Steven A. and Ipeirotis, Panos and Silva, Victor and Kannawadi, Arun},title={{SCHOLARLY: Simple access to Google Scholar authors and citation using Python}},year={2021},doi={10.5281/zenodo.5764801},license={Unlicense},url={https://github.com/scholarly-python-package/scholarly},version={1.5.1}}LicenseThe original code that this project was forked from was released byLuciano Bellounder aWTFPLlicense. In keeping with this mentality, all code is released under theUnlicense.