summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus@darmarit.de>2021-04-04 12:43:55 +0200
committerMarkus Heiser <markus@darmarit.de>2021-04-04 13:16:38 +0200
commitc12826c6d5c3962dd4652de83e45e67a3ba88ac2 (patch)
tree211d71ccfe694de5de4afcfdb00f3d3d30ebe52e /searx/webapp.py
parent76a5305ee2b64053d2cc419a312933972795e77d (diff)
downloadsearxng-c12826c6d5c3962dd4652de83e45e67a3ba88ac2.tar.gz
searxng-c12826c6d5c3962dd4652de83e45e67a3ba88ac2.zip
[fix] publishedDate: don't try to get date from empty string or None
Signed-off-by: Markus Heiser <markus@darmarit.de>
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index b4466c718..7f874d3aa 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: