searxng/searxng · warning · SearxEngineAccessDeniedException
{data[message] | Forbid spider access}
Error message
{data[message] | Forbid spider access} What it means
Raised in baidu's response() when the parsed JSON contains antiFlag == 1: Baidu's anti-spider system flagged the request. The message defaults to 'Forbid spider access' unless the API supplies one. It maps to SearxEngineAccessDeniedException, marking the engine access-denied (temporarily banned).
Source
Thrown at searx/engines/baidu.py:139
params["cookies"] = get_image_cookies(params["headers"])
params["url"] = f"{query_url}?{urlencode(query_params)}"
params["allow_redirects"] = False
return params
def response(resp):
# Detect Baidu Captcha, it will redirect to wappass.baidu.com
if 'wappass.baidu.com/static/captcha' in resp.headers.get('Location', ''):
raise SearxEngineCaptchaException()
text = resp.text
if baidu_category == 'images':
# baidu's JSON encoder wrongly quotes / and ' characters by \\ and \'
text = text.replace(r"\/", "/").replace(r"\'", "'")
data = json.loads(text, strict=False)
if data.get("antiFlag") == 1:
raise SearxEngineAccessDeniedException(data.get("message", "Forbid spider access"))
parsers = {'general': parse_general, 'images': parse_images, 'it': parse_it}
return parsers[baidu_category](data)
def parse_general(data):
results = []
if not data.get("feed", {}).get("entry"):
raise SearxEngineAPIException("Invalid response")
for entry in data["feed"]["entry"]:
if not entry.get("title") or not entry.get("url"):
continue
published_date = None
if entry.get("time"):
try:
published_date = datetime.fromtimestamp(entry["time"])View on GitHub (pinned to 9fea41204f)
Solutions
- Wait out the access-denied period (SearXNG auto-suspends then retries the engine)
- Clear the cached Baidu cookies (the engine caches cookies with expiry) so fresh ones are fetched
- Move the instance behind a different egress IP / proxy
- Lower request frequency to Baidu
Example fix
null
Defensive patterns
Strategy: fallback
Validate before calling
null
Try / catch
try:
results = search(query)
except SearxEngineAccessDeniedException:
results = [] # engine auto-banned for a period; fall back to other engines Prevention
- Reduce Baidu query concurrency and rate
- Periodically flush cached cookies so fresh ones are fetched
- Distribute searches across multiple engines/egress IPs
When it happens
Trigger: A search request (often the images category JSON API) returns JSON with "antiFlag":1 — Baidu's server-side bot detection rejected the query from this IP/cookie session.
Common situations: Heavy automated querying from a datacenter IP, stale or burned cookies from the engine's cookie cache, or querying in bursts that resemble scraping.
Related errors
- google_scholar: unusual traffic detected
- Unsupported category: {baidu_category}
- Invalid response
- VQD missed (page: {params['pageno']}, locale: {params['searx
- CAPTCHA ({params['data']['kl']})
AI-assisted analysis of searxng/searxng@9fea41204f (2026-08-27).
Data as JSON: /api/errors/45f7fb3dc6eb9928.
Report an issue: GitHub.