71 for result
in res[
'results']:
72 url = result.get(
'primaryPaperLink', {}).get(
'url')
73 if not url
and result.get(
'links'):
74 url = result.get(
'links')[0]
76 alternatePaperLinks = result.get(
'alternatePaperLinks')
77 if alternatePaperLinks:
78 url = alternatePaperLinks[0].get(
'url')
80 url = base_url +
'/paper/%s' % result[
'id']
83 if 'pubDate' in result:
84 publishedDate = datetime.strptime(result[
'pubDate'],
"%Y-%m-%d")
89 authors = [author[0][
'name']
for author
in result.get(
'authors', [])]
93 for doc
in result.get(
'alternatePaperLinks', []):
94 if doc[
'linkType']
not in (
'crawler',
'doi'):
100 if 'citationStats' in result:
102 '{numCitations} citations from the year {firstCitationVelocityYear} to {lastCitationVelocityYear}'
104 numCitations=result[
'citationStats'][
'numCitations'],
105 firstCitationVelocityYear=result[
'citationStats'][
'firstCitationVelocityYear'],
106 lastCitationVelocityYear=result[
'citationStats'][
'lastCitationVelocityYear'],
111 'template':
'paper.html',
113 'title': result[
'title'][
'text'],
114 'content': html_to_text(result[
'paperAbstract'][
'text']),
115 'journal': result.get(
'venue', {}).get(
'text')
or result.get(
'journal', {}).get(
'name'),
116 'doi': result.get(
'doiInfo', {}).get(
'doi'),
117 'tags': result.get(
'fieldsOfStudy'),
120 'publishedDate': publishedDate,
121 'comments': comments,