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:
parent
a18801a6aa
commit
9dd44af2d4
|
|
@ -9,7 +9,7 @@ from urllib.parse import urlparse
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from playwright.async_api import async_playwright
|
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-URL und Modell
|
||||||
OPENROUTER_BASE = "https://openrouter.ai/api/v1"
|
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,
|
viewport=VIEWPORT,
|
||||||
java_script_enabled=True,
|
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()
|
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)
|
# Versuch 1: Direkt zur Zielseite (z. B. https://www.mckinsey.com/featured-insights)
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user