This commit is contained in:
doms9 2025-11-13 12:43:55 -05:00
parent 4f6e1caa5f
commit 00000d9c6d
16 changed files with 106 additions and 89 deletions

View file

@ -1,5 +1,4 @@
import re
from pathlib import Path
import httpx
@ -7,12 +6,12 @@ from .utils import Cache, Time, get_logger, leagues
log = get_logger(__name__)
urls: dict[str, dict[str, str]] = {}
urls: dict[str, dict[str, str | float]] = {}
CACHE_FILE = Cache("tvpass.json", exp=86_400)
BASE_URL = "https://tvpass.org/playlist/m3u"
CACHE_FILE = Cache(Path(__file__).parent / "caches" / "tvpass.json", exp=86_400)
async def fetch_m3u8(client: httpx.AsyncClient) -> list[str]:
try:
@ -20,6 +19,7 @@ async def fetch_m3u8(client: httpx.AsyncClient) -> list[str]:
r.raise_for_status()
except Exception as e:
log.error(f'Failed to fetch "{BASE_URL}": {e}')
return []
return r.text.splitlines()