fix livetvsx.py scraping
This commit is contained in:
doms9 2026-01-28 18:59:40 -05:00
parent 2df2b31a4b
commit 00000d9e57
2 changed files with 6 additions and 6 deletions

View file

@ -57,7 +57,7 @@ async def process_event(
label = (await img.get_attribute("alt") or "").lower()
if label == "web":
if not label or label == "web":
continue
href = await btn.get_attribute("href")
@ -193,7 +193,9 @@ async def scrape(browser: Browser) -> None:
log.info(f"Processing {len(events)} new URL(s)")
if events:
async with network.event_context(browser, ignore_https=True) as context:
async with network.event_context(
browser, ignore_https=True, stealth=False
) as context:
for i, ev in enumerate(events, start=1):
async with network.event_page(context) as page:
handler = partial(

View file

@ -154,8 +154,7 @@ class Network:
)
if stealth:
await context.add_init_script(
"""
await context.add_init_script("""
Object.defineProperty(navigator, "webdriver", { get: () => undefined });
Object.defineProperty(navigator, "languages", {
@ -203,8 +202,7 @@ class Network:
});
observer.observe(document.documentElement, { childList: true, subtree: true });
"""
)
""")
else:
context = await browser.new_context()