mirror of
https://github.com/searxng/searxng.git
synced 2026-07-17 21:41:24 +00:00
[fix] kagi: crashes when there are no results
This commit is contained in:
@@ -139,9 +139,13 @@ def response(resp: "SXNG_Response") -> EngineResults:
|
|||||||
|
|
||||||
if kagi_categ in ("images", "videos"):
|
if kagi_categ in ("images", "videos"):
|
||||||
# the JSON key is "image" for "images" and "video" for "videos"
|
# the JSON key is "image" for "images" and "video" for "videos"
|
||||||
json_results = json_data["data"][kagi_categ[:-1]]
|
json_results = json_data["data"].get(kagi_categ[:-1])
|
||||||
else:
|
else:
|
||||||
json_results = json_data["data"][kagi_categ]
|
json_results = json_data["data"].get(kagi_categ)
|
||||||
|
|
||||||
|
# if no results were found, the response doesn't contain the results field
|
||||||
|
if not json_results:
|
||||||
|
return res
|
||||||
|
|
||||||
for result in json_results:
|
for result in json_results:
|
||||||
published_date: datetime | None = None
|
published_date: datetime | None = None
|
||||||
|
|||||||
Reference in New Issue
Block a user