on master help sign in
Merge pull request #2718 from return42/fix-publishedDate

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

commitba90c5a2e0629b0a04a090f11781782d15ca5dbe authorNoémi Ványi <kvch@users.noreply.github.com> dateSun 4 Apr 2021, 23:00 (6 years ago) parent0c68f2ec12826c
1 file changed+1−1
searx/webapp.py+1−1
searx/webapp.py+1−1
@@ -650,7 +650,7 @@ def search():
650650 result['pretty_url'] = prettify_url(result['url'])
651651
652652 # TODO, check if timezone is calculated right
653− if 'publishedDate' in result:
653+ if result.get('publishedDate'): # do not try to get a date from an empty string or a None type
654654 try: # test if publishedDate >= 1900 (datetime module bug)
655655 result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z')
656656 except ValueError: