From 22e1d3001794ecf89f3e3eee9844af8f48aeffc8 Mon Sep 17 00:00:00 2001 From: Aadniz <8147434+Aadniz@users.noreply.github.com> Date: Sun, 26 Oct 2025 11:32:45 +0100 Subject: [PATCH] [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. --- searx/engines/startpage.py | 4 ++++ 1 file changed, 4 insertions(+) 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', {})