e
This commit is contained in:
parent
4f6e1caa5f
commit
00000d9c6d
16 changed files with 106 additions and 89 deletions
|
|
@ -1,5 +1,4 @@
|
|||
from functools import partial
|
||||
from pathlib import Path
|
||||
|
||||
import httpx
|
||||
from playwright.async_api import async_playwright
|
||||
|
|
@ -10,9 +9,9 @@ log = get_logger(__name__)
|
|||
|
||||
urls: dict[str, dict[str, str | float]] = {}
|
||||
|
||||
CACHE_FILE = Cache(Path(__file__).parent / "caches" / "lotus.json", exp=3_600)
|
||||
CACHE_FILE = Cache("lotus.json", exp=3_600)
|
||||
|
||||
API_CACHE = Cache(Path(__file__).parent / "caches" / "lotus_api.json", exp=28_800)
|
||||
API_CACHE = Cache("lotus-api.json", exp=28_800)
|
||||
|
||||
BASE_URL = "https://lotusgamehd.xyz/api-event.php"
|
||||
|
||||
|
|
@ -33,6 +32,7 @@ async def refresh_api_cache(
|
|||
r.raise_for_status()
|
||||
except Exception as e:
|
||||
log.error(f'Failed to fetch "{url}": {e}')
|
||||
|
||||
return {}
|
||||
|
||||
data = r.json()
|
||||
|
|
@ -58,7 +58,7 @@ async def get_events(
|
|||
|
||||
API_CACHE.write(api_data)
|
||||
|
||||
events: list[dict[str, str]] = []
|
||||
events = []
|
||||
|
||||
for info in api_data["days"]:
|
||||
day = Time.from_str(info["day_et"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue