Cookies 5
This commit is contained in:
@@ -33,7 +33,14 @@ import httpx
|
||||
from atproto import Client
|
||||
from dotenv import load_dotenv
|
||||
from playwright.sync_api import sync_playwright
|
||||
from playwright_stealth import stealth_sync
|
||||
# playwright-stealth 1.x uses stealth_sync, 2.x uses Stealth class
|
||||
try:
|
||||
from playwright_stealth import stealth_sync
|
||||
_STEALTH_V2 = False
|
||||
except ImportError:
|
||||
from playwright_stealth import Stealth
|
||||
_STEALTH_V2 = True
|
||||
|
||||
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# Logging
|
||||
@@ -577,7 +584,11 @@ def scrape_tiktoks_via_playwright(handle: str) -> list:
|
||||
page = context.new_page()
|
||||
|
||||
# Stealth mode
|
||||
stealth_sync(page)
|
||||
# Stealth mode — compatible with both v1.x and v2.x
|
||||
if _STEALTH_V2:
|
||||
Stealth().apply_stealth_sync(page)
|
||||
else:
|
||||
stealth_sync(page)
|
||||
|
||||
# Mask automation signals
|
||||
page.add_init_script("""
|
||||
|
||||
Reference in New Issue
Block a user