Skip to content

Commit cb86f8b

Browse files
authored
Update update_citations.py
1 parent 299258b commit cb86f8b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scripts/update_citations.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@
44
from datetime import datetime
55
import os
66

7-
author: dict = scholarly.search_author_id(os.environ['GOOGLE_SCHOLAR_ID'])
7+
SCHOLAR_USER_ID = "8-IhrB0AAAAJ" # your Google Scholar user ID
8+
OUT_PATH = "assets/json/citations.json"
9+
10+
author: dict = scholarly.search_author_id(SCHOLAR_USER_ID)
811
scholarly.fill(author, sections=['basics', 'indices', 'counts', 'publications'])
912
name = author['name']
1013
author['updated'] = str(datetime.now())
1114
author['publications'] = {v['author_pub_id']:v for v in author['publications']}
1215
print(json.dumps(author, indent=2))
13-
os.makedirs('results', exist_ok=True)
14-
with open(f'results/gs_data.json', 'w') as outfile:
16+
os.makedirs(os.path.dirname(OUT_PATH), exist_ok=True)
17+
18+
with open(f'assets/json/citations.json', 'w') as outfile:
1519
json.dump(author, outfile, ensure_ascii=False)
1620

21+
1722
shieldio_data = {
1823
"schemaVersion": 1,
1924
"label": "citations",
2025
"message": f"{author['citedby']}",
2126
}
22-
with open(f'results/gs_data_shieldsio.json', 'w') as outfile:
27+
with open(f'assets/json/citations_shieldsio.json', 'w') as outfile:
2328
json.dump(shieldio_data, outfile, ensure_ascii=False)

0 commit comments

Comments
 (0)