diff options
| author | Bnyro <bnyro@tutanota.com> | 2026-09-05 11:53:19 +0200 |
|---|---|---|
| committer | Bnyro <bnyro@tutanota.com> | 2026-09-05 19:47:23 +0200 |
| commit | 28b61729c7bce33c5217d830c47f9b59fe222d62 (patch) | |
| tree | 3b6755007689e40e24b7c5d8c36c6ba2c3796a2e /searx/engines/resulthunter.py | |
| parent | 14a9f84c6c8c5eec2b1f6f1a54a30777c7c5f646 (diff) | |
[fix] resulthunter: detect blocked requests instead of returning 0 results
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) |
