This commit is contained in:
doms9 2025-09-13 04:42:55 -04:00
parent c2aa25a654
commit 00000d934a
12 changed files with 231 additions and 68 deletions

View file

@ -104,7 +104,7 @@ async def process_event(url: str, url_num: int) -> str | None:
async def get_events(
client: httpx.AsyncClient,
url: str,
cached_keys: list[str],
cached_keys: set[str],
) -> list[dict[str, str]]:
try:
r = await client.get(url)
@ -136,9 +136,9 @@ async def get_events(
time_text = time_span.text(strip=True)
timestamp = int(time_span.attributes.get("data-zaman"))
key = f"[{sport}] {name}"
key = f"[{sport}] {name} (SEAST)"
if key in cached_keys:
if cached_keys & {key}:
continue
event_dt = datetime.fromtimestamp(timestamp, TZ)
@ -188,14 +188,15 @@ async def main(client: httpx.AsyncClient) -> None:
)
if url:
key = f"[{ev['sport']}] {ev['event']} (SEAST)"
entry = {
"url": url,
"logo": ev["logo"],
"base": base_url,
"timestamp": now.timestamp(),
}
key = f"[{ev['sport']}] {ev['event']}"
urls[key] = cached_urls[key] = entry
if new_count := len(cached_urls) - cached_count: