This commit is contained in:
doms9 2025-09-20 23:26:18 -04:00
parent 5a61e2a8d5
commit 00000d9db0
11 changed files with 809 additions and 162 deletions

View file

@ -66,11 +66,11 @@ async def get_m3u8_links(client: httpx.AsyncClient, url: str) -> list[str]:
html = re.sub(r"<!--.*?-->", "", r.text, flags=re.DOTALL)
tree = HTMLParser(html)
soup = HTMLParser(html)
m3u8_links = []
for btn in tree.css("button[onclick]"):
for btn in soup.css("button[onclick]"):
onclick = btn.attributes.get("onclick", "")
if match := re.search(r"src\s*=\s*['\"](.*?)['\"]", onclick):
@ -79,7 +79,7 @@ async def get_m3u8_links(client: httpx.AsyncClient, url: str) -> list[str]:
if ".m3u8" in link:
m3u8_links.append(link)
if iframe := tree.css_first("iframe#iframe"):
if iframe := soup.css_first("iframe#iframe"):
src = iframe.attributes.get("src", "")
if ".m3u8" in src and src not in m3u8_links:
@ -91,7 +91,7 @@ async def get_m3u8_links(client: httpx.AsyncClient, url: str) -> list[str]:
return m3u8_links
async def main(client: httpx.AsyncClient) -> None:
async def scrape(client: httpx.AsyncClient) -> None:
if not (base_url := await get_base(client, MIRRORS)):
log.warning("No working ace mirrors")
return