Sort Google Scholar by the Number of Citations
sortgs is a Python tool for ranking Google Scholar publications by the number of citations. It is useful for finding relevant papers in a specific field. The data acquired from Google Scholar includes Title, Citations, Links, Rank, and a new column with the number of citations per year. In the background, it first try to fetch results using python requests. If it fails, it will use selenium to fetch the results.
🚀 Run it on Google Colab
- No-Code Version (new!):
— No coding required! Perfect for a quick start! ⚡
- Code Version:
— For developers who want full control of what's behind the scenes! 💻
💡 All you need is a Google Account to get started.
⚠️ Note: Google Scholar may block access after too many repetitive requests due to CAPTCHA checks, so proceed mindfully!
📚 Colab No-Code Instructions
https://github.com/user-attachments/assets/25de7bad-2a5d-4bcf-b486-faa1d7a29eb3
Installation
You can install sortgs directly using pip:
pip install sortgs
This will install the latest version of sortgs and its dependencies.
Usage
Once installed, you can run sortgs directly from the command line:
sortgs "your keyword"
Replace "your keyword" with any keyword you'd like to search for. A CSV file with the name your_keyword.csv will be created in your current directory.
Misc
For a feedback, send me an email: fernando [dot] wittmann [at] gmail [dot] com
Command Line Arguments
usage: sortgs [-h] [--sortby SORTBY] [--nresults NRESULTS] [--csvpath CSVPATH]
[--notsavecsv] [--plotresults] [--startyear STARTYEAR]
[--endyear ENDYEAR] [--debug] kw
positional arguments:
kw Keyword to be searched. Use double quote followed by
simple quote for an exact keyword.
Example: sortgs "'exact keyword'"
optional arguments:
-h, --help show this help message and exit
--sortby SORTBY Column to be sorted by. Default is "Citations". To sort
by citations per year, use --sortby "cit/year"
--langfilter LANGFILTER [LANGFILTER ...]
Only languages listed are permitted to pass the filter.
List of supported language codes: zh-CN, zh-TW, nl, en, fr,
de, it, ja, ko, pl, pt, es, tr
--nresults NRESULTS Number of articles to search on Google Scholar. Default
is 100. (careful with robot checking if value is high)
--csvpath CSVPATH Path to save the exported csv file. Default is the
current folder
--notsavecsv By default, results are exported to a csv file. Select
this option to just print results but not store them
--plotresults Use this flag to plot results with the original rank on
the x-axis and the number of citations on the y-axis.
Default is False
--startyear STARTYEAR
Start year when searching. Default is None
--endyear ENDYEAR End year when searching. Default is current year
--debug Debug mode. Used for unit testing. It will get pages
stored on web archive
Examples
-
Default Search:
sortgs "machine learning"
This command searches for the top 100 results related to "machine learning" and saves them as a CSV file.
-
Sort by Citations per Year:
sortgs "machine learning" --sortby "cit/year"
Search for "machine learning" and sort by the number of citations per year.
-
Specify Date Range:
sortgs "machine learning" --startyear 2005 --endyear 2015
Search for papers from 2005 to 2015.
-
Search for an Exact Keyword:
sortgs "'machine learning'"
-
Save Results in a Specific Path:
sortgs 'neural networks' --csvpath './examples/'
This will save the results under a subfolder called 'examples'.
-
Multiple Keywords:
sortgs '"deep learning" OR "neural networks" OR "machine learning"' --sortby "cit/year"
-
Language Filter:
sortgs "machine learning" --langfilter pt es fr de
This will only include articles in Portuguese, Spanish, French, and German.
Output Example
While running, sortgs will provide updates in the terminal:
❯ sortgs "'machine learning'"
Running with the following parameters:
Keyword: 'machine learning', Number of results: 100, Save database: True, Path: /Users/wittmann/sort-google-scholar, Sort by: Citations, Plot results: False, Start year: None, End year: 2023, Debug: False
Loading next 10 results
Loading next 20 results
...
Step-by-Step Installation
- Install Python 3.10+ (a published release uses
pip install sortgs) - From a checkout, use uv:
uv sync --group dev
uv run sortgs "your keyword"
- A CSV file with the name
your_keyword.csvshould be created.
If those steps are too complicated for you, send me an email with a list of keyworks that you'd like them ranked to: fernando [dot] wittmann [at] gmail [dot] com
Running Project Using Docker
This guide will walk you through the process of installing Docker, pulling the fernandowittmann/sort-google-scholar Docker image, and running the project.
Step 1: Install Docker
Windows or Mac
- Download Docker Desktop: Go to the Docker Desktop website and download the appropriate installer for your operating system.
- Install Docker Desktop: Run the installer and follow the on-screen instructions.
- Verify Installation: Open a terminal (or command prompt on Windows) and run
docker --versionto verify that Docker has been installed successfully.
Linux
- Update Package Index: Run
sudo apt-get updateto update your package index. - Install Docker: Run
sudo apt-get install docker-ce docker-ce-cli containerd.ioto install Docker. - Start Docker: Run
sudo systemctl start dockerto start the Docker daemon. - Verify Installation: Run
docker --versionto ensure Docker is installed correctly.
Step 2: Pull the Docker Image
-
Pull Image: Run the following command to pull the
fernandowittmann/sort-google-scholarimage from Docker Hub:docker pull fernandowittmann/sort-google-scholar
Step 3: Run the Project
-
Run the Docker Container: Use the following command to run the container:
docker run -v "$PWD/sortgs-results:/app" fernandowittmann/sort-google-scholar "machine learning"
Replace
$PWDwith the absolute path to your results directory if you are not in the parent directory ofsortgs-results.
Contributing
See CONTRIBUTING.md for uv setup, tests, pull requests, and the main / PyPI release checklist. Short version:
uv sync --group dev
uv run pytest
About Robot Check
Google Scholar may block access after too many repetitive requests due to CAPTCHA checks. The direct path sends a browser User-Agent so a plain requests call is less likely to be rejected as python-requests. If a block page still appears, Selenium is used as a fallback. You might be asked to solve a CAPTCHA manually. If both paths fail, sortgs exits with status 1 and does not write an empty CSV.
Google Colab shared IPs are often blocked, and the hosted runtime does not start the Chrome session this project uses. Prefer a local run, or a VPN, if Colab returns an empty table.
When using Selenium locally, you might need Chrome and a matching chromedriver. See https://developer.chrome.com/docs/chromedriver/downloads.
LICENSE
- MIT
Updates
Main branch has been renamed from master. Update it locally by running:
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
💖 Support the Project
If you find this project helpful and would like to support its development, consider making a donation. Your support is greatly appreciated!
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sortgs-1.0.8.tar.gz.
File metadata
- Download URL: sortgs-1.0.8.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1825b1b171632bcbec0c483fb6d0f36cdad02a53b17ec129f37fd84778bd1b
|
|
| MD5 |
a6f3309459de77d235e621ef42e125d4
|
|
| BLAKE2b-256 |
35959f0190049bafa4c1d07b9cb9e4082904e2b2292f267ae677d38e327e4af7
|
File details
Details for the file sortgs-1.0.8-py3-none-any.whl.
File metadata
- Download URL: sortgs-1.0.8-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
828f817e36401ae30110af1c3c4df5aff3f611beace5a471f76fb9af98d5affa
|
|
| MD5 |
c57ab7571552c194467259b7e3f0564b
|
|
| BLAKE2b-256 |
5f7926ba7f2c74f08f89d3dcf6baa6a3f28df107a4ffb02ab213e97598ea0fe5
|