use wider window for embedhd.py
use different mirror for totalsportek.py
This commit is contained in:
doms9 2026-01-08 23:13:38 -05:00
parent f336fff671
commit 00000d9a79
2 changed files with 5 additions and 11 deletions

View file

@ -38,9 +38,6 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]:
events = [] events = []
start_dt = now.delta(minutes=-30)
end_dt = now.delta(minutes=30)
for info in api_data.get("days", []): for info in api_data.get("days", []):
for event in info["items"]: for event in info["items"]:
if (event_league := event["league"]) == "channel tv": 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") 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 continue
sport = fix_league(event_league) sport = fix_league(event_league)

View file

@ -14,7 +14,7 @@ TAG = "TOTALSPRTK"
CACHE_FILE = Cache(f"{TAG.lower()}.json", exp=28_800) 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: 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) 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.") log.warning(f"URL {url_num}) No iframe element found.")
return None, None return None, None
if ( if not (iframe_src := iframe.attributes.get("src")):
not (iframe_src := iframe.attributes.get("src"))
or "xsportportal" not in iframe_src
):
log.warning(f"URL {url_num}) No valid iframe source found.") log.warning(f"URL {url_num}) No valid iframe source found.")
return None, None 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") 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]]: async def get_events(cached_keys: list[str]) -> list[dict[str, str]]: