This commit is contained in:
doms9 2025-09-04 14:50:52 -04:00
parent cf93e1326b
commit 00000d98b8
2 changed files with 10 additions and 11 deletions

View file

@ -14,7 +14,7 @@ from .utils import TZ, get_base, get_logger, now, safe_process_event
log = get_logger(__name__)
urls: dict[str, dict[str, str]] = {}
urls: dict[str, dict[str, str | float]] = {}
API_FILE = Path(__file__).parent / "caches" / "ppv_api.json"
@ -189,13 +189,15 @@ async def main(client: httpx.AsyncClient) -> None:
cached_urls = load_cache()
cached_count = len(cached_urls)
log.info(f"Collected {cached_count} event(s) from cache")
events = await get_events(
client,
urljoin(base_url, "/api/streams"),
set(cached_urls.keys()),
)
log.info(f"Processing {len(events)} URLs")
log.info(f"Processing {len(events)} new URLs")
for i, ev in enumerate(events, start=1):
url = await safe_process_event(
@ -217,7 +219,7 @@ async def main(client: httpx.AsyncClient) -> None:
CACHE_FILE.write_text(json.dumps(cached_urls, indent=2), encoding="utf-8")
log.info(f"Collected {len(cached_urls) - cached_count} event(s)")
log.info(f"Collected {len(cached_urls) - cached_count} new event(s)")
# works if no cloudflare bot detection