46 res = loads(resp.text)
48 for result
in res[
'results']:
49 url = result.get(
'primaryPaperLink', {}).get(
'url')
50 if not url
and result.get(
'links'):
51 url = result.get(
'links')[0]
53 alternatePaperLinks = result.get(
'alternatePaperLinks')
54 if alternatePaperLinks:
55 url = alternatePaperLinks[0].get(
'url')
57 url = paper_url +
'/%s' % result[
'id']
60 if 'pubDate' in result:
61 publishedDate = datetime.strptime(result[
'pubDate'],
"%Y-%m-%d")
66 authors = [author[0][
'name']
for author
in result.get(
'authors', [])]
70 for doc
in result.get(
'alternatePaperLinks', []):
71 if doc[
'linkType']
not in (
'crawler',
'doi'):
77 if 'citationStats' in result:
79 '{numCitations} citations from the year {firstCitationVelocityYear} to {lastCitationVelocityYear}'
81 numCitations=result[
'citationStats'][
'numCitations'],
82 firstCitationVelocityYear=result[
'citationStats'][
'firstCitationVelocityYear'],
83 lastCitationVelocityYear=result[
'citationStats'][
'lastCitationVelocityYear'],
88 'template':
'paper.html',
90 'title': result[
'title'][
'text'],
91 'content': result[
'paperAbstract'][
'text'],
92 'journal': result.get(
'venue', {}).get(
'text')
or result.get(
'journal', {}).get(
'name'),
93 'doi': result.get(
'doiInfo', {}).get(
'doi'),
94 'tags': result.get(
'fieldsOfStudy'),
97 'publishedDate': publishedDate,