Tutorial#
Here we will show the basic commands for working with pygscholar
. When you install pygscholar
you will get access to the scholar
command which you can use in the terminal. In this tutorial we are running the commands from a notebook and therefore all commands starts with a !
. However if you are using a terminal, then you should not use the !
in front of the command.
The help option#
To see all the available options, you can type
$ scholar --help
!scholar --help
Usage: scholar [OPTIONS] COMMAND [ARGS]...
Command line interface for pygscholar. You can also set the environment
variable `PYSCHOLAR_CACHE_DIR` to change the default cache directory.
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --version Show version │
│ --license Show license │
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy │
│ it or customize the installation. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ list-authors List all authors │
│ search-author Search for authors │
│ add-author Add new author │
│ remove-author Remove author │
│ list-author-publications List authors publications │
│ list-new-author-publications List new authors publications │
│ list-department-publications List department publications │
│ list-new-department-publications List department publications │
│ generate-test-data Generate test data │
│ download-test-data Download test data │
╰──────────────────────────────────────────────────────────────────────────────╯
This will list all the available options with a message explaining the different sub-commands. For each sub-command you can also use the --help
option, e.g
$ scholar add-author --help
!scholar add-author --help
Usage: scholar add-author [OPTIONS] NAME
Add new author
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ * name TEXT [default: None] [required] │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --scholar-id TEXT │
│ --cache-dir TEXT [default: /home/runner/.pygscholar] │
│ --backend [scraper|scholarly] [default: scraper] │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
First we will download some test data in order not to spam Google Scholar with requests. This is only needed because Google scholar rejects requests if they are coming from an automated service. This is not needed if you run this from the terminal.
!scholar download-test-data local_db.json
Downloading test data from https://drive.google.com/uc?id=14VERTNNbU8l-24SDJKkGZqXuHvALtDfI&export=download to local_db.json
Listing publications for the whole department#
Our department now consists of two researchers (Henrik Finsberg and Jørgen Dokken), but you could imaging that you have a lot of researchers in your department. It would then be nice to list the most cited papers across the whole department. We can do this with the
$ scholar list-department-publications
command. Let us first loook at the help menu
!scholar list-department-publications --help
Usage: scholar list-department-publications [OPTIONS]
List department publications
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --n INTEGER [default: 5] │
│ --sort-by-citati… --no-sort-by-ci… [default: │
│ sort-by-citation… │
│ --add-authors --no-add-authors [default: │
│ no-add-authors] │
│ --max-age INTEGER [default: None] │
│ --update --no-update [default: │
│ no-update] │
│ --cache-dir TEXT [default: │
│ /home/runner/.py… │
│ --backend [scraper|scholar [default: │
│ ly] scraper] │
│ --help Show this message │
│ and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
Let us list the most cited papers not older than 2 year using the command
$ scholar list-department-publications --max-age=2
!scholar list-department-publications --max-age=2
Publications for department (Sorted by citations)
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Title ┃ Published year ┃ Number of citations ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ DOLFINx: the next generation FEniCS │ 2023 │ 174 │
│ problem solving environment │ │ │
│ Smart: Spatial modeling algorithms │ 2023 │ 6 │
│ for reaction and transport │ │ │
│ simcardems: A FEniCS-based cardiac │ 2023 │ 5 │
│ electro-mechanics solver │ │ │
│ A cell-based framework for modeling │ 2023 │ 5 │
│ cardiac mechanics │ │ │
│ Spatial modeling algorithms for │ 2024 │ 3 │
│ reactions and transport in biological │ │ │
│ cells │ │ │
└───────────────────────────────────────┴────────────────┴─────────────────────┘
We can also get the 5 most recent publications using the --no-sort-by-citations
flag
!scholar list-department-publications --no-sort-by-citations
Publications for department (Sorted by age)
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Title ┃ Published year ┃ Number of citations ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ A software benchmark for cardiac │ 2025 │ 1 │
│ elastodynamics │ │ │
│ Human induced pluripotent stem │ 2025 │ 0 │
│ cell-derived cardiomyocytes and their │ │ │
│ use in a cardiac organ-on-a-chip to │ │ │
│ assay electrophysiology, calcium and │ │ │
│ contractility │ │ │
│ On the numerical evaluation of wall │ 2025 │ 0 │
│ shear stress using the finite element │ │ │
│ method │ │ │
│ The latent variable proximal point │ 2025 │ 0 │
│ algorithm for variational problems │ │ │
│ with inequality constraints │ │ │
│ The Impact of Mechano-Electric │ 2024 │ 0 │
│ Feedback on Drug-and Stretch-Induced │ │ │
│ Arrhythmia Using a Computational │ │ │
│ Model of Cardiac Electromechanics │ │ │
└───────────────────────────────────────┴────────────────┴─────────────────────┘
It is also to possible to list new publications using the command
!scholar list-new-department-publications
2025-05-10 11:13:10 [info ] Get author info for Henrik Nicolay Finsberg
2025-05-10 11:13:10 [info ] Searching for author Henrik Nicolay Finsberg
2025-05-10 11:13:10 [debug ] Found 1 author(s)
2025-05-10 11:13:10 [debug ] Extracting all articles for NDPIHoEAAAAJ
2025-05-10 11:13:10 [info ] Updating author info for Henrik Nicolay Finsberg
2025-05-10 11:13:10 [debug ] Extracting author info
2025-05-10 11:13:10 [debug ] Extracting co-authors
2025-05-10 11:13:10 [info ] Get author info for Jørgen Schartum Dokken
2025-05-10 11:13:10 [info ] Searching for author Jørgen Schartum Dokken
2025-05-10 11:13:10 [debug ] Found 1 author(s)
2025-05-10 11:13:10 [debug ] Extracting all articles for hfeXoYMAAAAJ
2025-05-10 11:13:10 [info ] Updating author info for Jørgen Schartum Dokken
2025-05-10 11:13:10 [debug ] Extracting author info
2025-05-10 11:13:10 [debug ] Extracting co-authors
Publications for department (Sorted by
citations)
┏━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ Title ┃ Published year ┃ Number of citations ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
└───────┴────────────────┴─────────────────────┘