125def response(resp:
"SXNG_Response") -> EngineResults:
128 json_data: dict[str, dict[str, t.Any]] = resp.json()
130 if "error" in json_data:
133 def _str(k: str) -> str:
134 return str(doc.get(k,
""))
136 def _list(k: str) -> list[str]:
137 return doc.get(k, [])
139 for doc
in json_data[
"response"][
"docs"]:
140 authors: list[str] = doc[
"author"]
141 if len(authors) > 15:
143 authors = authors[:15] + [
"et al."]
145 paper = res.types.Paper(
146 url=f
"https://ui.adsabs.harvard.edu/abs/{doc.get('bibcode')}/",
147 title=html_to_text(_list(
"title")[0]),
149 content=html_to_text(_str(
"abstract")),
153 tags=_list(
"keyword"),
154 pages=
",".join(_list(
"page")),
155 publisher=_str(
"pub") +
" " + _str(
"year"),
156 publishedDate=datetime.fromisoformat(_str(
"date")),
157 volume=_str(
"volume"),
158 views=_str(
"read_count"),
159 comments=
" / ".join(_list(
"pubnote")),