ozon: fix false-positive challenge detector (was catching 'challenge' in normal JS)

This commit is contained in:
wasrusgen 2026-05-11 13:54:13 +03:00
parent e8b487891f
commit 1a948ebf02

View File

@ -40,8 +40,9 @@ def search_ozon(query: str, limit: int = 3, timeout: float = 30.0,
if not html: if not html:
log.warning("OZON: no HTML for query=%r", query) log.warning("OZON: no HTML for query=%r", query)
return [] return []
if "robotcheck" in html.lower() or "challenge" in html.lower()[:5000]: # Реальный anti-bot — это редирект на /robotcheck/ или специальная страница
log.warning("OZON: anti-bot challenge for query=%r", query) if "/robotcheck/" in html or "Доступ ограничен" in html[:5000]:
log.warning("OZON: anti-bot block for query=%r", query)
return [] return []
return _parse_html(html, limit=limit) return _parse_html(html, limit=limit)