Compare commits

..

No commits in common. "2cccac4aa798f501466b1537302abdf99648b02a" and "c115999e77498419d9c7cfc852c82f0b2258d6ff" have entirely different histories.

3 changed files with 712 additions and 1013 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -134,9 +134,8 @@ async def get_events(
async def scrape(client: httpx.AsyncClient) -> None: async def scrape(client: httpx.AsyncClient) -> None:
cached_urls = CACHE_FILE.load() cached_urls = CACHE_FILE.load()
valid_urls = {k: v for k, v in cached_urls.items() if v["url"]} cached_count = len(cached_urls)
valid_count = cached_count = len(valid_urls) urls.update(cached_urls)
urls.update(valid_urls)
log.info(f"Loaded {cached_count} event(s) from cache") log.info(f"Loaded {cached_count} event(s) from cache")
@ -184,13 +183,13 @@ async def scrape(client: httpx.AsyncClient) -> None:
"link": ev["link"], "link": ev["link"],
} }
if url: cached_urls[key] = entry
valid_count += 1
urls[key] = entry urls[key] = cached_urls[key] = entry
await browser.close() await browser.close()
if new_count := valid_count - cached_count: if new_count := len(cached_urls) - cached_count:
log.info(f"Collected and cached {new_count} new event(s)") log.info(f"Collected and cached {new_count} new event(s)")
else: else:
log.info("No new events found") log.info("No new events found")