From 00000d90de3f71b1ec8e01b01401fae4e5d45e4a Mon Sep 17 00:00:00 2001 From: doms9 <96013514+doms9@users.noreply.github.com> Date: Fri, 27 Feb 2026 15:39:06 -0500 Subject: [PATCH] e add mlb for webcast.py --- M3U8/scrapers/watchfooty.py | 2 +- M3U8/scrapers/webcast.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/M3U8/scrapers/watchfooty.py b/M3U8/scrapers/watchfooty.py index ac07670a..c48f3e5e 100644 --- a/M3U8/scrapers/watchfooty.py +++ b/M3U8/scrapers/watchfooty.py @@ -297,7 +297,7 @@ async def scrape(browser: Browser) -> None: if url: valid_count += 1 - + entry["url"] = url.split("&t")[0] urls[key] = entry diff --git a/M3U8/scrapers/webcast.py b/M3U8/scrapers/webcast.py index 15a9128b..a2477424 100644 --- a/M3U8/scrapers/webcast.py +++ b/M3U8/scrapers/webcast.py @@ -14,9 +14,10 @@ TAG = "WEBCAST" 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 = { + "MLB": "https://mlbwebcast.com", # "NFL": "https://nflwebcast.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) - title = soup.css_first("title").text(strip=True) - - sport = "NFL" if "NFL" in title else "NHL" + sport = next((k for k, v in BASE_URLS.items() if v == url), "Live Event") date_text = now.strftime("%B %d, %Y")