This commit is contained in:
doms9 2025-09-05 12:00:23 -04:00
parent 00000d98b2
commit 00000d9449
5 changed files with 17 additions and 18 deletions

View file

@ -6,7 +6,7 @@ from urllib.parse import urljoin
import httpx
from selectolax.parser import HTMLParser
from .utils import get_logger, load_cache, safe_process_event
from .utils import get_logger, load_cache, now, safe_process_event
log = get_logger(__name__)
@ -79,7 +79,7 @@ async def get_events(client: httpx.AsyncClient) -> list[dict[str, str]]:
async def main(client: httpx.AsyncClient) -> None:
if cached := load_cache(CACHE_FILE, hour=12):
if cached := load_cache(CACHE_FILE, exp=86400):
urls.update(cached)
log.info(f"Collected {len(urls)} event(s) from cache")
return
@ -101,6 +101,7 @@ async def main(client: httpx.AsyncClient) -> None:
entry = {
"url": url,
"logo": ev["logo"],
"timestamp": now.timestamp(),
}
urls[f"[{ev['sport']}] {ev['event']}"] = entry