diff --git a/M3U8/scrapers/utils/config.py b/M3U8/scrapers/utils/config.py index 6c7d9e0..76ceb1c 100644 --- a/M3U8/scrapers/utils/config.py +++ b/M3U8/scrapers/utils/config.py @@ -167,11 +167,14 @@ async def check_status(client: httpx.AsyncClient, url: str) -> bool: return r.status_code == 200 -async def get_base(client: httpx.AsyncClient, mirrors: list[str]) -> str: +async def get_base(client: httpx.AsyncClient, mirrors: list[str]) -> str | None: tasks = [check_status(client, link) for link in mirrors] results = await asyncio.gather(*tasks) - return [url for url, ok in zip(mirrors, results) if ok][0] + try: + return [url for url, ok in zip(mirrors, results) if ok][0] + except IndexError: + return def capture_req(