iptv/M3U8/scrapers/utils/config.py

64 lines
1.6 KiB
Python
Raw Normal View History

2025-09-19 15:44:02 -04:00
import json
2025-09-04 09:59:19 -04:00
from datetime import datetime
2025-09-19 15:44:02 -04:00
from pathlib import Path
2025-09-03 15:00:17 -04:00
import pytz
TZ = pytz.timezone("America/New_York")
2025-09-04 09:59:19 -04:00
now = datetime.now(TZ)
2025-09-11 14:55:53 -04:00
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"
)
2025-09-19 15:44:02 -04:00
live_img = "https://i.gyazo.com/978f2eb4a199ca5b56b447aded0cb9e3.png"
leagues_file = Path(__file__).parent / "leagues.json"
2025-09-13 21:04:01 -04:00
2025-09-19 15:44:02 -04:00
LEAGUES: dict[str, dict[str, str]] = json.loads(
leagues_file.read_text(encoding="utf-8")
)
2025-09-19 02:05:40 -04:00
2025-09-13 21:04:01 -04:00
alias_map = {
2025-09-19 02:05:40 -04:00
"Bundesliga": ["German Bundesliga", "Bundeslig"],
"F1": ["Formula 1", "Formula One"],
"La Liga": ["Spanish La Liga", "Laliga"],
"MLB": ["Major League Baseball", "Baseball"],
2025-09-16 20:40:48 -04:00
"MLS": ["Major League Soccer"],
2025-09-19 02:05:40 -04:00
"Moto GP": ["MotoGP"],
2025-09-16 15:55:08 -04:00
"NCAA": ["CBB", "CFB", "NCAAB", "NCAAF"],
2025-09-19 02:05:40 -04:00
"NFL": ["American Football", "USA NFL"],
2025-09-13 21:04:01 -04:00
"Premier League": ["EPL"],
2025-09-19 02:05:40 -04:00
"Primeira Liga": ["Liga Portugal"],
2025-09-19 17:35:18 -04:00
"Racing": ["Motorsports", "Motorsport"],
"Soccer": [
"Eredivisie",
"FA WSL",
"Football",
"Liga I",
"Liga Profesional Argentina",
"Ligue 2",
"NWSL",
"UEFA Europa League",
"World Cup",
"World Cup Qualifiers",
],
2025-09-16 15:55:08 -04:00
"UEFA Champions League": ["Champions League", "UCL"],
2025-09-16 20:40:48 -04:00
"WNBA": ["NBA W"],
2025-09-13 21:04:01 -04:00
}
2025-09-19 15:44:02 -04:00
for k, v in LEAGUES.items():
if not v["logo"]:
LEAGUES[k]["logo"] = live_img
2025-09-13 21:04:01 -04:00
for base, aliases in alias_map.items():
for alias in aliases:
2025-09-19 02:05:40 -04:00
LEAGUES[alias] = LEAGUES[base]
def league_info(name: str) -> dict:
return LEAGUES.get(name, LEAGUES["default"])