diff options
author | Noémi Ványi <kvch@users.noreply.github.com> | 2021-04-04 23:00:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 23:00:22 +0200 |
commit | ba90c5a2e0629b0a04a090f11781782d15ca5dbe (patch) | |
tree | 4d7c16acc7c241d2afa416de4ece5b824c955fd2 | |
parent | 0c68f2ee5f344a53cc0f23e6768be0fa30d3c80b (diff) | |
parent | c12826c6d5c3962dd4652de83e45e67a3ba88ac2 (diff) | |
download | searxng-ba90c5a2e0629b0a04a090f11781782d15ca5dbe.tar.gz searxng-ba90c5a2e0629b0a04a090f11781782d15ca5dbe.zip |
Merge pull request #2718 from return42/fix-publishedDate
[fix] publishedDate: don't try to get date from empty string or None
-rwxr-xr-x | searx/webapp.py | 2 |
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: |