e
This commit is contained in:
parent
8094466d7d
commit
00000d99d8
15 changed files with 402 additions and 30 deletions
|
|
@ -17,7 +17,13 @@ CACHE_FILE = Cache("strmd.json", exp=10_800)
|
|||
|
||||
API_FILE = Cache("strmd-api.json", exp=28_800)
|
||||
|
||||
MIRRORS = ["https://streami.su", "https://streamed.st", "https://streamed.pk"]
|
||||
MIRRORS = [
|
||||
"https://streami.su",
|
||||
"https://streamed.st",
|
||||
"https://streamed.pk",
|
||||
]
|
||||
|
||||
TAG = "STRMD"
|
||||
|
||||
|
||||
def fix_sport(s: str) -> str:
|
||||
|
|
@ -116,17 +122,14 @@ async def process_event(
|
|||
|
||||
async def get_events(
|
||||
client: httpx.AsyncClient,
|
||||
base_url: str,
|
||||
url: str,
|
||||
cached_keys: set[str],
|
||||
) -> list[dict[str, str]]:
|
||||
|
||||
if not (api_data := API_FILE.load(per_entry=False, index=-1)):
|
||||
api_data = await refresh_api_cache(
|
||||
client,
|
||||
urljoin(
|
||||
base_url,
|
||||
"api/matches/all-today",
|
||||
),
|
||||
urljoin(url, "api/matches/all-today"),
|
||||
)
|
||||
|
||||
API_FILE.write(api_data)
|
||||
|
|
@ -157,9 +160,9 @@ async def get_events(
|
|||
parts = pattern.split(event["title"].strip())
|
||||
name = " | ".join(p.strip() for p in parts if p.strip())
|
||||
|
||||
logo = urljoin(base_url, poster) if (poster := event.get("poster")) else None
|
||||
logo = urljoin(url, poster) if (poster := event.get("poster")) else None
|
||||
|
||||
key = f"[{sport}] {name} (STRMD)"
|
||||
key = f"[{sport}] {name} ({TAG})"
|
||||
|
||||
if cached_keys & {key}:
|
||||
continue
|
||||
|
|
@ -244,7 +247,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
ev["timestamp"],
|
||||
)
|
||||
|
||||
key = f"[{sport}] {event} (STRMD)"
|
||||
key = f"[{sport}] {event} ({TAG})"
|
||||
|
||||
tvg_id, pic = leagues.get_tvg_info(sport, event)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue