e
This commit is contained in:
parent
8094466d7d
commit
00000d99d8
15 changed files with 402 additions and 30 deletions
|
|
@ -37,6 +37,8 @@ SPORT_ENDPOINTS = [
|
|||
# "volleyball",
|
||||
]
|
||||
|
||||
TAG = "WFTY"
|
||||
|
||||
|
||||
async def get_api_data(client: httpx.AsyncClient, url: str) -> list[dict[str, Any]]:
|
||||
try:
|
||||
|
|
@ -164,12 +166,12 @@ async def process_event(
|
|||
|
||||
async def get_events(
|
||||
client: httpx.AsyncClient,
|
||||
base_url: str,
|
||||
url: str,
|
||||
cached_keys: set[str],
|
||||
) -> list[dict[str, str]]:
|
||||
|
||||
if not (api_data := API_FILE.load(per_entry=False, index=-1)):
|
||||
api_data = await refresh_api_cache(client, base_url)
|
||||
api_data = await refresh_api_cache(client, url)
|
||||
|
||||
API_FILE.write(api_data)
|
||||
|
||||
|
|
@ -200,9 +202,9 @@ async def get_events(
|
|||
|
||||
sport = pattern.split(league, 1)[0].strip()
|
||||
|
||||
logo = urljoin(base_url, poster) if (poster := event.get("poster")) else None
|
||||
logo = urljoin(url, poster) if (poster := event.get("poster")) else None
|
||||
|
||||
key = f"[{sport}] {name} (WFTY)"
|
||||
key = f"[{sport}] {name} ({TAG})"
|
||||
|
||||
if cached_keys & {key}:
|
||||
continue
|
||||
|
|
@ -211,7 +213,7 @@ async def get_events(
|
|||
{
|
||||
"sport": sport,
|
||||
"event": name,
|
||||
"link": urljoin(base_url, f"stream/{match_id}"),
|
||||
"link": urljoin(url, f"stream/{match_id}"),
|
||||
"logo": logo,
|
||||
"timestamp": event_dt.timestamp(),
|
||||
}
|
||||
|
|
@ -268,7 +270,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
ev["timestamp"],
|
||||
)
|
||||
|
||||
key = f"[{sport}] {event} (WFTY)"
|
||||
key = f"[{sport}] {event} ({TAG})"
|
||||
|
||||
tvg_id, pic = leagues.get_tvg_info(sport, event)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue