mirror of
https://github.com/doms9/iptv.git
synced 2026-03-07 11:18:25 +01:00
e
fix livetvsx.py scraping
This commit is contained in:
parent
2df2b31a4b
commit
00000d9e57
2 changed files with 6 additions and 6 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue