summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoémi Ványi <kvch@users.noreply.github.com>2020-04-15 23:41:24 +0200
committerGitHub <noreply@github.com>2020-04-15 23:41:24 +0200
commit826ef3d00959f22a57224fa5e69fb088583f0072 (patch)
treec681cc52463ae6fab9f68c36e4f1edff6df84261
parent4eddbca81d7a9f7d2c8b7059a2b4d0787804cbb0 (diff)
parentfcb44c654228a210ed66533f6aa7847035cbf985 (diff)
downloadsearxng-826ef3d00959f22a57224fa5e69fb088583f0072.tar.gz
searxng-826ef3d00959f22a57224fa5e69fb088583f0072.zip
Merge pull request #1879 from bauruine/fix_startpage_ValueError_on_spanish_datetime
[Fix] Startpage ValueError on Spanish date format
-rw-r--r--searx/engines/startpage.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py
index 76567396f..953734934 100644
--- a/searx/engines/startpage.py
+++ b/searx/engines/startpage.py
@@ -99,11 +99,14 @@ def response(resp):
if re.match(r"^([1-9]|[1-2][0-9]|3[0-1]) [A-Z][a-z]{2} [0-9]{4} \.\.\. ", content):
date_pos = content.find('...') + 4
date_string = content[0:date_pos - 5]
- published_date = parser.parse(date_string, dayfirst=True)
-
# fix content string
content = content[date_pos:]
+ try:
+ published_date = parser.parse(date_string, dayfirst=True)
+ except ValueError:
+ pass
+
# check if search result starts with something like: "5 days ago ... "
elif re.match(r"^[0-9]+ days? ago \.\.\. ", content):
date_pos = content.find('...') + 4