e
This commit is contained in:
parent
8796e2dfc6
commit
00000d9ef1
7 changed files with 318 additions and 44 deletions
|
|
@ -18,7 +18,7 @@ MIRRORS = [
|
|||
]
|
||||
|
||||
|
||||
async def get_hrefs(client: httpx.AsyncClient, base_url: str) -> list[tuple[str, str]]:
|
||||
async def get_events(client: httpx.AsyncClient, base_url: str) -> list[tuple[str, str]]:
|
||||
log.info(f'Scraping from "{base_url}"')
|
||||
|
||||
try:
|
||||
|
|
@ -55,7 +55,7 @@ async def get_hrefs(client: httpx.AsyncClient, base_url: str) -> list[tuple[str,
|
|||
return events.items()
|
||||
|
||||
|
||||
async def fetch_m3u8(client: httpx.AsyncClient, url: str) -> tuple[str, list[str]]:
|
||||
async def process_events(client: httpx.AsyncClient, url: str) -> tuple[str, list[str]]:
|
||||
try:
|
||||
r = await client.get(url)
|
||||
r.raise_for_status()
|
||||
|
|
@ -89,9 +89,9 @@ async def main(client: httpx.AsyncClient) -> None:
|
|||
log.warning("No working FSTV mirrors")
|
||||
return
|
||||
|
||||
events = await get_hrefs(client, base_url)
|
||||
events = await get_events(client, base_url)
|
||||
|
||||
tasks = [fetch_m3u8(client, href) for _, href in events if href]
|
||||
tasks = [process_events(client, href) for _, href in events if href]
|
||||
results = await asyncio.gather(*tasks)
|
||||
|
||||
for (event, _), (match_name, m3u8_urls) in zip(events, results):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue