From c12826c6d5c3962dd4652de83e45e67a3ba88ac2 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 4 Apr 2021 12:43:55 +0200 Subject: [PATCH] [fix] publishedDate: don't try to get date from empty string or None Signed-off-by: Markus Heiser --- searx/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/webapp.py b/searx/webapp.py index b4466c71..7f874d3a 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -650,7 +650,7 @@ def search(): result['pretty_url'] = prettify_url(result['url']) # TODO, check if timezone is calculated right - if 'publishedDate' in result: + if result.get('publishedDate'): # do not try to get a date from an empty string or a None type try: # test if publishedDate >= 1900 (datetime module bug) result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z') except ValueError: