Skip to content

Instantly share code, notes, and snippets.

@pzelasko
Created July 25, 2023 21:13
Show Gist options
  • Save pzelasko/2bce3abdc2f25284be402a4f7428ec75 to your computer and use it in GitHub Desktop.
Save pzelasko/2bce3abdc2f25284be402a4f7428ec75 to your computer and use it in GitHub Desktop.
Download Google Scholar citation list as a persistent Python dict
# Note: after downloading ~250 citations further connections might be blocked by Google Scholar.
import time
import shelve
# Make sure to run: pip install scholarly tqdm
from scholarly import scholarly
from tqdm.auto import tqdm
search_query = scholarly.search_author('Piotr Żelasko') # replace the author
first_author_result = next(search_query)
author = scholarly.fill(first_author_result)
citations = shelve.open("refs", writeback=True)
for publication in tqdm(author["publications"], desc="Publications"):
title = publication["bib"]["title"]
if title in citations and publication["num_citations"] == len(citations[title]):
continue
current = []
for citation in tqdm(scholarly.citedby(publication), desc="Citations"):
current.append(citation)
time.sleep(0.1)
citations[title] = current
citations.sync()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment