Updated scout_logic.py to use the new Stealth class for bot detection evasion, replacing the previous stealth_async function call.

This commit is contained in:
Lars 2026-01-31 18:13:40 +01:00
parent a18801a6aa
commit 9dd44af2d4

View File

@ -9,7 +9,7 @@ from urllib.parse import urlparse
import httpx
from playwright.async_api import async_playwright
from playwright_stealth.stealth import stealth_async
from playwright_stealth import Stealth
# OpenRouter Base-URL und Modell
OPENROUTER_BASE = "https://openrouter.ai/api/v1"
@ -76,9 +76,9 @@ async def _fetch_links_impl(domain: str, disable_http2: bool = False) -> list[di
viewport=VIEWPORT,
java_script_enabled=True,
)
# Stealth auf Kontext anwenden (API 2.x: apply_stealth_async(context))
await Stealth().apply_stealth_async(context)
page = await context.new_page()
# Stealth entscheidend gegen extreme Bot-Detection
await stealth_async(page)
# Versuch 1: Direkt zur Zielseite (z. B. https://www.mckinsey.com/featured-insights)
try: