Reliably scrape and clean Google Scholar citations. Automatically uploads to Zotero. Bibtex local file exports are also supported.
Project description
pyserpZotero
Installation:
pip install pyserpZotero
Usage:
psz
Google Scholar citation download, parsing, Bibtex export, search for free PDFs, and Zotero cloud upload. SerpAPI is leveraged for stable access to Google Scholar without IP throttling.
Resource | URL |
---|---|
Docs | https://pyserpzotero.readthedocs.io |
GitHub Repo | https://github.com/hack-r/pyserpZotero |
PyPI Package | https://pypi.org/project/pyserpZotero/ |
SerpAPI | https://serpAPI.com |
Zotero | https://zotero.org |
What does it do?
pyserpZotero is a Python library designed to automate the search, management of scholarly literature citations, and attachment of free PDFs to Zotero citations. It leverages the power of SerpAPI for reliable access to Google Scholar and utilizes the Zotero service for efficient citation management. The library simplifies the process of searching for academic papers, downloading them (where available for free), and organizing citations directly into your Zotero library.
pyserpZotero offers the following functions for (semi-) automating literature review tasks:
- SerpZot (class) - Instantiates a SerpZot object for API management.
- SearchScholar - Searches Google Scholar for papers corresponding to 1 or more search terms and captures their identifiers.
- Search2Zotero - Pulls references from Google using identifiers from SearchScholar, converts to Bibtex via CrossRef, reformats for Zotero, looks for PDFs, and uploads to your Zotero cloud library (results will automatically sync to the desktop client, if installed).
- CleanZot - Attempt to remove/replace broken LaTex and other formatting in titles.
Why SerpAPI?
I'm not a shill for their company, but after a decade of scraping data I've gotten tired of code breaking due to upstream changes, dealing with proxies, and concerns over intellectual property. SerpAPI handles those things for you. They offer a free tier, which is currently 100 searches per month and decent pricing.
I may add a proxy scraper later with logic for directly scraping Scholar and other portals, but have been hesistant to do so due to the potential for upstream changes and other risks.
How to configure it?
You'll need to provide an API key for serpAPI and Zotero, as well as a Zotero library Id. You can either provide these directly as arguments to the functions, via the interactive mode, or manage them more securely via a YAML configuration file, as in the Example Usage below.
How to use it?
Beginning with v1.1 an interactive mode is available by entering psz
into a terminal. See quickstart.ipynb for a Jupyter notebook demonstration of API access.
What's new?
- Interactive mode! Just enter
psz
in a terminal afterpip install pyserpZotero
to use this library as a program. You can enter your credentials when prompted or edit the config.yaml file to bypass interactive authentication. - Added support for additional portals and PDF sources, including medArxiv and bioRxiv. Improved matching of citations to Arxiv PDFs.
Why do you sometimes align assignment operators across lines like that?
As a data scientist, I'm a programming polyglot and long-time R programmer. Following top style guides for R, some of us like our code to be readable by human beings without wasting much time on it - it's a trick for easily making the code structured.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyserpzotero-1.1.1.tar.gz
.
File metadata
- Download URL: pyserpzotero-1.1.1.tar.gz
- Upload date:
- Size: 5.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47396da611e3c1af236b022266538016e5d12076fe72e3b5c0de04117dfce0b5 |
|
MD5 | 6b77da2c1fef2a0f8f5c5d9b70a4f27f |
|
BLAKE2b-256 | 3abf5aa6eca53f17ab6dbe775006ebd1657e24df35997d4b5e91243d3d5c7617 |
File details
Details for the file pyserpzotero-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: pyserpzotero-1.1.1-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0940c046de5cb3a0b655c8e9cd0d2f3c57ae493ea0e70cf9b5d877822cb34be0 |
|
MD5 | 73ae9358c80f4c5f92ff08f41f50e866 |
|
BLAKE2b-256 | 3215e26fdd3b28dcf8c7ef7bfc8aef40a8e9458cc8afd0a459e0b58f6c309b4c |