From 00000d9a799362dad3fc33ec4bb5d3e00e4fd48b Mon Sep 17 00:00:00 2001 From: doms9 <96013514+doms9@users.noreply.github.com> Date: Thu, 8 Jan 2026 23:13:38 -0500 Subject: [PATCH] e use wider window for embedhd.py use different mirror for totalsportek.py --- M3U8/scrapers/embedhd.py | 5 +---- M3U8/scrapers/totalsportek.py | 11 ++++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/M3U8/scrapers/embedhd.py b/M3U8/scrapers/embedhd.py index ed22f54..7415c78 100644 --- a/M3U8/scrapers/embedhd.py +++ b/M3U8/scrapers/embedhd.py @@ -38,9 +38,6 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]: events = [] - start_dt = now.delta(minutes=-30) - end_dt = now.delta(minutes=30) - for info in api_data.get("days", []): for event in info["items"]: if (event_league := event["league"]) == "channel tv": @@ -48,7 +45,7 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]: event_dt = Time.from_str(event["when_et"], timezone="ET") - if not start_dt <= event_dt <= end_dt: + if now.date() != event_dt.date(): continue sport = fix_league(event_league) diff --git a/M3U8/scrapers/totalsportek.py b/M3U8/scrapers/totalsportek.py index 8ec5c48..65eb325 100644 --- a/M3U8/scrapers/totalsportek.py +++ b/M3U8/scrapers/totalsportek.py @@ -14,7 +14,7 @@ TAG = "TOTALSPRTK" CACHE_FILE = Cache(f"{TAG.lower()}.json", exp=28_800) -BASE_URL = "https://live.totalsportek777.com/" +BASE_URL = "https://live2.totalsportek777.com/" def fix_league(s: str) -> str: @@ -29,15 +29,12 @@ async def process_event(url: str, url_num: int) -> tuple[str | None, str | None] soup = HTMLParser(html_data.content) - if not (iframe := soup.css_first("iframe")): + if not (iframe := soup.css_first(".box iframe")): log.warning(f"URL {url_num}) No iframe element found.") return None, None - if ( - not (iframe_src := iframe.attributes.get("src")) - or "xsportportal" not in iframe_src - ): + if not (iframe_src := iframe.attributes.get("src")): log.warning(f"URL {url_num}) No valid iframe source found.") return None, None @@ -56,7 +53,7 @@ async def process_event(url: str, url_num: int) -> tuple[str | None, str | None] log.info(f"URL {url_num}) Captured M3U8") - return bytes.fromhex(match[2]).decode("utf-8"), iframe_src + return match[2], iframe_src async def get_events(cached_keys: list[str]) -> list[dict[str, str]]: