add mlb for webcast.py
This commit is contained in:
doms9 2026-02-27 15:39:06 -05:00
parent 4c078a0b4b
commit 00000d90de
2 changed files with 4 additions and 5 deletions

View file

@ -297,7 +297,7 @@ async def scrape(browser: Browser) -> None:
if url: if url:
valid_count += 1 valid_count += 1
entry["url"] = url.split("&t")[0] entry["url"] = url.split("&t")[0]
urls[key] = entry urls[key] = entry

View file

@ -14,9 +14,10 @@ TAG = "WEBCAST"
CACHE_FILE = Cache(TAG, exp=10_800) CACHE_FILE = Cache(TAG, exp=10_800)
HTML_CACHE = Cache(f"{TAG}-html", exp=86_400) HTML_CACHE = Cache(f"{TAG}-html", exp=19_800)
BASE_URLS = { BASE_URLS = {
"MLB": "https://mlbwebcast.com",
# "NFL": "https://nflwebcast.com", # "NFL": "https://nflwebcast.com",
"NHL": "https://slapstreams.com", "NHL": "https://slapstreams.com",
} }
@ -36,9 +37,7 @@ async def refresh_html_cache(url: str) -> dict[str, dict[str, str | float]]:
soup = HTMLParser(html_data.content) soup = HTMLParser(html_data.content)
title = soup.css_first("title").text(strip=True) sport = next((k for k, v in BASE_URLS.items() if v == url), "Live Event")
sport = "NFL" if "NFL" in title else "NHL"
date_text = now.strftime("%B %d, %Y") date_text = now.strftime("%B %d, %Y")