Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

[fix] startpage engine: properly display CAPTCHA if redirect page is seen (#5380)

Aadniz22e1d3001794
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', {})