-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_publication.py
44 lines (40 loc) · 1.16 KB
/
get_publication.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import scholarly
import pickle
import yaml
if __name__ == "__main__":
with open('/Users/kashu/Downloads/main.pkl', 'rb') as f:
data = pickle.load(f)
# format web clawed data into a list of dictionaries
publications = []
for pub in data:
title = pub["bib"]["title"]
try:
authors = pub["bib"]["author"]
except:
continue
try:
year = pub["bib"]["pub_year"]
except:
year = None
pub_type = 0
if "journal" in pub["bib"].keys():
venue = pub["bib"]["journal"]
pub_type = 1
elif "conference" in pub["bib"].keys():
venue = pub["bib"]["conference"]
pub_type = 2
try:
url = pub["pub_url"]
except:
url = None
publications.append({
"title": title,
"authors": authors,
"url": url,
"type": pub_type,
"venue": venue,
"year": year,
})
# save the publication data into a yaml file
with open("_data/publist.yml", "w") as f:
yaml.dump(publications, f)