This commit is contained in:
doms9 2025-10-14 12:28:46 -04:00
parent efcbc718e9
commit 00000d91f4

View file

@ -103,43 +103,19 @@ async def process_event(
text = await header.inner_text() text = await header.inner_text()
except TimeoutError: except TimeoutError:
log.warning(f"URL {url_num}) Can't find stream links header.")
return return
match = re.search(r"\((\d+)\)", text) match = re.search(r"\((\d+)\)", text)
if not match or int(match[1]) == 0: if not match or int(match[1]) == 0:
return log.warning(f"URL {url_num}) No available stream links.")
try:
frame_el = await page.wait_for_selector(
"iframe[src*='embed.best-sports.stream']",
timeout=4_000,
)
except TimeoutError:
log.warning("No iframe found — exiting early.")
return
iframe = await frame_el.content_frame()
if not iframe:
return
try:
await iframe.wait_for_selector(
"button.vds-play-button",
state="visible",
timeout=4_000,
)
await iframe.click("button.vds-play-button")
except TimeoutError:
log.warning("Play button not found inside iframe.")
return return
wait_task = asyncio.create_task(got_one.wait()) wait_task = asyncio.create_task(got_one.wait())
try: try:
await asyncio.wait_for(wait_task, timeout=10) await asyncio.wait_for(wait_task, timeout=6)
except asyncio.TimeoutError: except asyncio.TimeoutError:
log.warning(f"URL {url_num}) Timed out waiting for M3U8.") log.warning(f"URL {url_num}) Timed out waiting for M3U8.")
return return