summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAadniz <8147434+Aadniz@users.noreply.github.com>2025-10-26 11:32:45 +0100
committerGitHub <noreply@github.com>2025-10-26 11:32:45 +0100
commit22e1d3001794ecf89f3e3eee9844af8f48aeffc8 (patch)
treeab27236148394b270c9610318e7bf3ca0f4aeff5
parent4ca75a04500d932ffefb48072c63aa35670a952f (diff)
[fix] startpage engine: properly display CAPTCHA if redirect page is seen (#5380)
Fixes an issue where startpage engine would display parsing error (`json.decoder.JSONDecodeError`) when returning CAPTCHA redirect page. The fix simply checks if response header has `Location` set, and if it starts with `https://www.startpage.com/sp/captcha`, it will raise a CAPTCHA exception before trying to parse the data.
-rw-r--r--searx/engines/startpage.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py
index adffa4109..cfa5de331 100644
--- a/searx/engines/startpage.py
+++ b/searx/engines/startpage.py
@@ -404,6 +404,10 @@ def _get_image_result(result) -> dict[str, t.Any] | None:
def response(resp):
categ = startpage_categ.capitalize()
results_raw = '{' + extr(resp.text, f"React.createElement(UIStartpage.AppSerp{categ}, {{", '}})') + '}}'
+
+ if resp.headers.get('Location', '').startswith("https://www.startpage.com/sp/captcha"):
+ raise SearxEngineCaptchaException()
+
results_json = loads(results_raw)
results_obj = results_json.get('render', {}).get('presenter', {}).get('regions', {})