diff options
Diffstat (limited to 'searx/engines/resulthunter.py')
| -rw-r--r-- | searx/engines/resulthunter.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/searx/engines/resulthunter.py b/searx/engines/resulthunter.py index 5ebda3e7e..ee0384bad 100644 --- a/searx/engines/resulthunter.py +++ b/searx/engines/resulthunter.py @@ -10,6 +10,7 @@ from urllib.parse import urlencode from lxml import html from searx import locales +from searx.exceptions import SearxEngineResponseException from searx.result_types import EngineResults from searx.utils import eval_xpath_list, eval_xpath, extract_text @@ -112,6 +113,11 @@ def _image_results(doc: "ElementBase") -> EngineResults: def response(resp: "SXNG_Response") -> EngineResults: doc = html.fromstring(resp.text) + # if the request was wrong (e.g. missing params), the site doesn't contain a result container + # and instead shows an "Installation required" page to download the resulthunter browser extension + if not eval_xpath(doc, "//div[contains(@class, 'organic-results-container')]"): + raise SearxEngineResponseException() + match resulthunter_categ: case "web": return _general_results(doc) |
