mirror of
https://github.com/searxng/searxng.git
synced 2026-05-07 18:03:51 +02:00
[fix] Startpage engine fails when date field is string (not integer: TypeError) (#6053)
In order to avoid an abort with an error, type- and value- errors are catched, the publishDate cannot then be determined, but the result item remains. [1] https://github.com/searxng/searxng/pull/5980/changes#r3091479655 Replaces the PRs: - https://github.com/searxng/searxng/pull/5980 - https://github.com/searxng/searxng/pull/6006 Closes: https://github.com/searxng/searxng/issues/5979 Suggested-by: @Bnyro [1] Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
@@ -345,7 +345,10 @@ def _get_news_result(result):
|
|||||||
|
|
||||||
publishedDate = None
|
publishedDate = None
|
||||||
if result.get("date"):
|
if result.get("date"):
|
||||||
publishedDate = datetime.fromtimestamp(result["date"] / 1000)
|
try:
|
||||||
|
publishedDate = datetime.fromtimestamp(int(result["date"]) / 1000)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
pass
|
||||||
|
|
||||||
thumbnailUrl = None
|
thumbnailUrl = None
|
||||||
if result.get("thumbnailUrl"):
|
if result.get("thumbnailUrl"):
|
||||||
|
|||||||
Reference in New Issue
Block a user