mirror of
https://github.com/doms9/iptv.git
synced 2026-01-21 03:59:03 +01:00
e
This commit is contained in:
parent
ad80c3c982
commit
00000d998e
2 changed files with 51 additions and 59 deletions
|
|
@ -141,7 +141,7 @@ async def get_events(
|
|||
|
||||
live = []
|
||||
|
||||
start_ts = now.delta(minutes=-30).timestamp()
|
||||
start_ts = now.delta(hours=-1).timestamp()
|
||||
end_ts = now.delta(minutes=5).timestamp()
|
||||
|
||||
for k, v in events.items():
|
||||
|
|
@ -158,9 +158,8 @@ async def get_events(
|
|||
|
||||
async def scrape(client: httpx.AsyncClient) -> None:
|
||||
cached_urls = CACHE_FILE.load()
|
||||
valid_urls = {k: v for k, v in cached_urls.items() if v["url"]}
|
||||
valid_count = cached_count = len(valid_urls)
|
||||
urls.update(valid_urls)
|
||||
cached_count = len(cached_urls)
|
||||
urls.update(cached_urls)
|
||||
|
||||
log.info(f"Loaded {cached_count} event(s) from cache")
|
||||
|
||||
|
|
@ -190,6 +189,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
log=log,
|
||||
)
|
||||
|
||||
if url:
|
||||
sport, event, logo, link, ts = (
|
||||
ev["sport"],
|
||||
ev["event"],
|
||||
|
|
@ -211,15 +211,11 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
"link": link,
|
||||
}
|
||||
|
||||
cached_urls[key] = entry
|
||||
|
||||
if url:
|
||||
valid_count += 1
|
||||
urls[key] = entry
|
||||
urls[key] = cached_urls[key] = entry
|
||||
|
||||
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)")
|
||||
else:
|
||||
log.info("No new events found")
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ async def get_events(
|
|||
|
||||
events = []
|
||||
|
||||
start_dt = now.delta(minutes=-30)
|
||||
start_dt = now.delta(hours=-1)
|
||||
end_dt = now.delta(minutes=5)
|
||||
|
||||
for stream_group in api_data:
|
||||
|
|
@ -139,9 +139,8 @@ async def get_events(
|
|||
|
||||
async def scrape(client: httpx.AsyncClient) -> None:
|
||||
cached_urls = CACHE_FILE.load()
|
||||
valid_urls = {k: v for k, v in cached_urls.items() if v["url"]}
|
||||
valid_count = cached_count = len(valid_urls)
|
||||
urls.update(valid_urls)
|
||||
cached_count = len(cached_urls)
|
||||
urls.update(cached_urls)
|
||||
|
||||
log.info(f"Loaded {cached_count} event(s) from cache")
|
||||
|
||||
|
|
@ -170,6 +169,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
log=log,
|
||||
)
|
||||
|
||||
if url:
|
||||
sport, event, ts, link = (
|
||||
ev["sport"],
|
||||
ev["event"],
|
||||
|
|
@ -190,15 +190,11 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
"link": link,
|
||||
}
|
||||
|
||||
cached_urls[key] = entry
|
||||
|
||||
if url:
|
||||
valid_count += 1
|
||||
urls[key] = entry
|
||||
urls[key] = cached_urls[key] = entry
|
||||
|
||||
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)")
|
||||
else:
|
||||
log.info("No new events found")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue