From 130cea600ddaba8b2e4aa02c7c3508ccdb3b837b Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 7 May 2026 14:56:14 +0200 Subject: [PATCH] [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 --- searx/engines/startpage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py index c688b7cb4..8e890ec98 100644 --- a/searx/engines/startpage.py +++ b/searx/engines/startpage.py @@ -345,7 +345,10 @@ def _get_news_result(result): publishedDate = None if result.get("date"): - publishedDate = datetime.fromtimestamp(result["date"] / 1000) + try: + publishedDate = datetime.fromtimestamp(int(result["date"]) / 1000) + except (TypeError, ValueError): + pass thumbnailUrl = None if result.get("thumbnailUrl"):