Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

[fix] publishedDate: don't try to get date from empty string or None

Markus Heiserc12826c6d5c3
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: