Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startpage parser breaks on Spanish date format #1870

Open
Nutomic opened this issue Feb 26, 2020 · 2 comments · May be fixed by #1879
Open

Startpage parser breaks on Spanish date format #1870

Nutomic opened this issue Feb 26, 2020 · 2 comments · May be fixed by #1879
Labels
Projects

Comments

@Nutomic
Copy link

@Nutomic Nutomic commented Feb 26, 2020

To reproduce, follow these steps:

  1. open searx.info (or another instance)

  2. search for a spanish term, eg "madrid tiempo ahora"

This results in an error like the following:

Los motores no pueden obtener resultados: (english: engines cant obtain results)

startpage (unexpected crash: ('Unknown string format:', '22 Ene 2020'))
bauruine added a commit to bauruine/searx that referenced this issue Mar 2, 2020
datetime.parser.parse() does not know the Spanish date format which
leads to a ValueError. Fixes asciimoo#1870

Traceback (most recent call last):
  File "/usr/local/searx/searx/search.py", line 160, in search_one_http_request_safe
    search_results = search_one_http_request(engine, query, request_params)
  File "/usr/local/searx/searx/search.py", line 97, in search_one_http_request
    return engine.response(response)
  File "/usr/local/searx/searx/engines/startpage.py", line 102, in response
    published_date = parser.parse(date_string, dayfirst=True)
  File "/usr/local/searx/searx-ve/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 1358, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/local/searx/searx-ve/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 649, in parse
    raise ValueError("Unknown string format:", timestr)
ValueError: ('Unknown string format:', '24 Ene 2013')
@bauruine

This comment has been minimized.

Copy link

@bauruine bauruine commented Mar 2, 2020

Could you please try again on searx.info? I deployed a fix but I'm not sure if it worked and i can't reproduce it even if i set the search and interface language to Spanish.

@Nutomic

This comment has been minimized.

Copy link
Author

@Nutomic Nutomic commented Mar 2, 2020

I also can't reproduce it anymore, guess your fix worked. Thanks!

@bauruine bauruine linked a pull request that will close this issue Mar 2, 2020
bauruine added a commit to bauruine/searx that referenced this issue Mar 2, 2020
datetime.parser.parse() does not know the Spanish date format which
leads to a ValueError. Fixes asciimoo#1870

Traceback (most recent call last):
  File "/usr/local/searx/searx/search.py", line 160, in search_one_http_request_safe
    search_results = search_one_http_request(engine, query, request_params)
  File "/usr/local/searx/searx/search.py", line 97, in search_one_http_request
    return engine.response(response)
  File "/usr/local/searx/searx/engines/startpage.py", line 102, in response
    published_date = parser.parse(date_string, dayfirst=True)
  File "/usr/local/searx/searx-ve/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 1358, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/local/searx/searx-ve/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 649, in parse
    raise ValueError("Unknown string format:", timestr)
ValueError: ('Unknown string format:', '24 Ene 2013')
bauruine added a commit to bauruine/searx that referenced this issue Mar 2, 2020
datetime.parser.parse() does not know the Spanish date format which
leads to a ValueError. Fixes asciimoo#1870

Traceback (most recent call last):
  File "/usr/local/searx/searx/search.py", line 160, in search_one_http_request_safe
    search_results = search_one_http_request(engine, query, request_params)
  File "/usr/local/searx/searx/search.py", line 97, in search_one_http_request
    return engine.response(response)
  File "/usr/local/searx/searx/engines/startpage.py", line 102, in response
    published_date = parser.parse(date_string, dayfirst=True)
  File "/usr/local/searx/searx-ve/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 1358, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/local/searx/searx-ve/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 649, in parse
    raise ValueError("Unknown string format:", timestr)
ValueError: ('Unknown string format:', '24 Ene 2013')
@kvch kvch added bug core labels Mar 6, 2020
bauruine added a commit to bauruine/searx that referenced this issue Mar 9, 2020
datetime.parser.parse() does not know the Spanish date format which
leads to a ValueError. Fixes asciimoo#1870

Traceback (most recent call last):
  File "/usr/local/searx/searx/search.py", line 160, in search_one_http_request_safe
    search_results = search_one_http_request(engine, query, request_params)
  File "/usr/local/searx/searx/search.py", line 97, in search_one_http_request
    return engine.response(response)
  File "/usr/local/searx/searx/engines/startpage.py", line 102, in response
    published_date = parser.parse(date_string, dayfirst=True)
  File "/usr/local/searx/searx-ve/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 1358, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/local/searx/searx-ve/lib/python3.6/site-packages/dateutil/parser/_parser.py", line 649, in parse
    raise ValueError("Unknown string format:", timestr)
ValueError: ('Unknown string format:', '24 Ene 2013')
@asciimoo asciimoo added this to Milestone #2 - Backend in v1.0.0 Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v1.0.0
  
Milestone #2 - Backend
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.