iptv/M3U8/scrapers/utils/config.py
2025-09-19 15:44:02 -04:00

51 lines
1.4 KiB
Python

import json
from datetime import datetime
from pathlib import Path
import pytz
TZ = pytz.timezone("America/New_York")
now = datetime.now(TZ)
UA = (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0"
)
live_img = "https://i.gyazo.com/978f2eb4a199ca5b56b447aded0cb9e3.png"
leagues_file = Path(__file__).parent / "leagues.json"
LEAGUES: dict[str, dict[str, str]] = json.loads(
leagues_file.read_text(encoding="utf-8")
)
alias_map = {
"Bundesliga": ["German Bundesliga", "Bundeslig"],
"F1": ["Formula 1", "Formula One"],
"La Liga": ["Spanish La Liga", "Laliga"],
"MLB": ["Major League Baseball", "Baseball"],
"MLS": ["Major League Soccer"],
"Moto GP": ["MotoGP"],
"NCAA": ["CBB", "CFB", "NCAAB", "NCAAF"],
"NFL": ["American Football", "USA NFL"],
"Premier League": ["EPL"],
"Primeira Liga": ["Liga Portugal"],
"Soccer": ["Football", "World Cup", "World Cup Qualifiers", "UEFA Europa League"],
"UEFA Champions League": ["Champions League", "UCL"],
"WNBA": ["NBA W"],
}
for k, v in LEAGUES.items():
if not v["logo"]:
LEAGUES[k]["logo"] = live_img
for base, aliases in alias_map.items():
for alias in aliases:
LEAGUES[alias] = LEAGUES[base]
def league_info(name: str) -> dict:
return LEAGUES.get(name, LEAGUES["default"])