70 for result
in res[
'results']:
71 url = result.get(
'primaryPaperLink', {}).get(
'url')
72 if not url
and result.get(
'links'):
73 url = result.get(
'links')[0]
75 alternatePaperLinks = result.get(
'alternatePaperLinks')
76 if alternatePaperLinks:
77 url = alternatePaperLinks[0].get(
'url')
79 url = base_url +
'/paper/%s' % result[
'id']
82 if 'pubDate' in result:
83 publishedDate = datetime.strptime(result[
'pubDate'],
"%Y-%m-%d")
88 authors = [author[0][
'name']
for author
in result.get(
'authors', [])]
92 for doc
in result.get(
'alternatePaperLinks', []):
93 if doc[
'linkType']
not in (
'crawler',
'doi'):
99 if 'citationStats' in result:
101 '{numCitations} citations from the year {firstCitationVelocityYear} to {lastCitationVelocityYear}'
103 numCitations=result[
'citationStats'][
'numCitations'],
104 firstCitationVelocityYear=result[
'citationStats'][
'firstCitationVelocityYear'],
105 lastCitationVelocityYear=result[
'citationStats'][
'lastCitationVelocityYear'],
110 'template':
'paper.html',
112 'title': result[
'title'][
'text'],
113 'content': html_to_text(result[
'paperAbstract'][
'text']),
114 'journal': result.get(
'venue', {}).get(
'text')
or result.get(
'journal', {}).get(
'name'),
115 'doi': result.get(
'doiInfo', {}).get(
'doi'),
116 'tags': result.get(
'fieldsOfStudy'),
119 'publishedDate': publishedDate,
120 'comments': comments,