e
This commit is contained in:
parent
efcbc718e9
commit
00000d91f4
1 changed files with 3 additions and 27 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue