This commit is contained in:
doms9 2025-09-24 12:30:55 -04:00
parent acb19b7886
commit 00000d9990
10 changed files with 718 additions and 747 deletions

View file

@ -12,7 +12,7 @@ from .utils import (
capture_req,
get_base,
get_logger,
league_info,
leagues,
load_cache,
new_browser,
now,
@ -36,49 +36,30 @@ MIRRORS = [
"https://freeppv.fun",
]
NFL_TEAMS = {
"Arizona Cardinals",
"Atlanta Falcons",
"Baltimore Ravens",
"Buffalo Bills",
"Carolina Panthers",
"Chicago Bears",
"Cincinnati Bengals",
"Cleveland Browns",
"Dallas Cowboys",
"Denver Broncos",
"Detroit Lions",
"Green Bay Packers",
"Houston Texans",
"Indianapolis Colts",
"Jacksonville Jaguars",
"Kansas City Chiefs",
"Las Vegas Raiders",
"Los Angeles Chargers",
"Los Angeles Rams",
"Miami Dolphins",
"Minnesota Vikings",
"New England Patriots",
"New Orleans Saints",
"New York Giants",
"New York Jets",
"Philadelphia Eagles",
"Pittsburgh Steelers",
"San Francisco 49ers",
"Seattle Seahawks",
"Tampa Bay Buccaneers",
"Tennessee Titans",
"Washington Commanders",
}
def get_tvg(sport: str, event: str) -> str | None:
match sport:
case "American Football":
if leagues.is_valid(event, "NFL"):
return "NFL.Dummy.us"
def is_nfl(event: str) -> bool:
try:
t1, t2 = event.split(" vs. ")
else:
return "NCAA.Sports.Dummy.us"
return t1 in NFL_TEAMS or t2 in NFL_TEAMS
except ValueError:
return event.lower() == "nfl redzone"
case "Basketball":
if leagues.is_valid(event, "NBA"):
return "NBA.Basketball.Dummy.us"
elif leagues.is_valid(event, "WNBA"):
return "WNBA.dummy.us"
# NCAA
else:
return "Basketball.Dummy.us"
case _:
return
async def refresh_api_cache(
@ -239,11 +220,6 @@ async def scrape(client: httpx.AsyncClient) -> None:
if url:
sport, event = ev["sport"], ev["event"]
if sport == "American Football":
tvg_id = "NFL.Dummy.us" if is_nfl(event) else "NCAA.Sports.Dummy.us"
else:
tvg_id = league_info(sport)[0]
key = f"[{sport}] {event} (PPV)"
entry = {
@ -251,7 +227,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
"logo": ev["logo"],
"base": base_url,
"timestamp": now.timestamp(),
"id": tvg_id or "Live.Event.us",
"id": get_tvg(sport, event) or "Live.Event.us",
}
urls[key] = cached_urls[key] = entry