Skip to content

Commit

Permalink
[fix] engine woxikon.de - don't raise exception on empty result list
Browse files Browse the repository at this point in the history
Woxikon expects a word in German, so with query "foo" the site finds nothing and
respons a 404:

    httpx.HTTPStatusError: Client error '404 Not Found' \
      for url 'https://synonyme.woxikon.de/synonyme/foo.php'

[1] searxng#1543 (comment)

Closes: searxng#1543
Suggested-by: @allendema [1]
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
  • Loading branch information
return42 committed Aug 19, 2022
1 parent 6f28a69 commit 7e3a6f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion searx/engines/xpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
'''Replacement ``{lang}`` in :py:obj:`search_url` if language ``all`` is
selected.
'''
raise_for_httperror = True
'''True by default: raise an exception if the HTTP code of response is ``>=
300``'''

soft_max_redirects = 0
'''Maximum redirects, soft limit. Record an error but don't stop the engine'''
Expand Down Expand Up @@ -176,7 +179,7 @@ def request(query, params):

params['url'] = search_url.format(**fargs)
params['soft_max_redirects'] = soft_max_redirects

params['raise_for_httperror'] = raise_for_httperror
return params


Expand Down
1 change: 1 addition & 0 deletions searx/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,7 @@ engines:
url_xpath: //div[@class="upper-synonyms"]/a/@href
content_xpath: //div[@class="synonyms-list-group"]
title_xpath: //div[@class="upper-synonyms"]/a
raise_for_httperror: false
about:
website: https://www.woxikon.de/
wikidata_id: # No Wikidata ID
Expand Down

0 comments on commit 7e3a6f5

Please sign in to comment.