This commit is contained in:
doms9 2025-10-31 14:45:23 -04:00
parent ebb255e166
commit 00000d9952

View file

@ -15,13 +15,12 @@ API_FILE = Cache(Path(__file__).parent / "caches" / "ppv_api.json", exp=28_800)
CACHE_FILE = Cache(Path(__file__).parent / "caches" / "ppv.json", exp=10_800) CACHE_FILE = Cache(Path(__file__).parent / "caches" / "ppv.json", exp=10_800)
MIRRORS = [ # MIRRORS = [
"https://ppvs.su", # "https://ppv.to",
"https://ppv.to", # "https://ppvs.su",
"https://ppv.wtf", # ]
"https://ppv.land",
"https://freeppv.fun", BASE_URL = "https://ppv.to"
]
async def refresh_api_cache( async def refresh_api_cache(
@ -108,16 +107,16 @@ async def scrape(client: httpx.AsyncClient) -> None:
log.info(f"Loaded {cached_count} event(s) from cache") log.info(f"Loaded {cached_count} event(s) from cache")
if not (base_url := await network.get_base(MIRRORS)): # if not (base_url := await network.get_base(MIRRORS)):
log.warning("No working PPV mirrors") # log.warning("No working PPV mirrors")
CACHE_FILE.write(cached_urls) # CACHE_FILE.write(cached_urls)
return # return
log.info(f'Scraping from "{base_url}"') log.info(f'Scraping from "{BASE_URL}"')
events = await get_events( events = await get_events(
client, client,
base_url, BASE_URL,
set(cached_urls.keys()), set(cached_urls.keys()),
) )
@ -158,7 +157,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
entry = { entry = {
"url": url, "url": url,
"logo": logo or pic, "logo": logo or pic,
"base": base_url, "base": BASE_URL,
"timestamp": ts, "timestamp": ts,
"id": tvg_id or "Live.Event.us", "id": tvg_id or "Live.Event.us",
} }