From 00000d9cf1b3484446f1070aa7f8ac0fa08f99d3 Mon Sep 17 00:00:00 2001 From: doms9 <96013514+doms9@users.noreply.github.com> Date: Fri, 17 Apr 2026 14:29:46 -0400 Subject: [PATCH] e - misc edits. --- M3U8/scrapers/tvapp.py | 22 ++++++++++++++++------ M3U8/scrapers/xstreameast.py | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/M3U8/scrapers/tvapp.py b/M3U8/scrapers/tvapp.py index 1c26f987..ac66402b 100644 --- a/M3U8/scrapers/tvapp.py +++ b/M3U8/scrapers/tvapp.py @@ -45,6 +45,8 @@ async def get_events() -> list[dict[str, str]]: if not (html_data := await network.request(BASE_URL, log=log)): return events + now = Time.clean(Time.now()) + soup = HTMLParser(html_data.content) for row in soup.css(".row"): @@ -55,9 +57,14 @@ async def get_events() -> list[dict[str, str]]: continue for a in row.css("a.list-group-item[href]"): - splits = a.text(strip=True).split(":") + x, y = a.text(strip=True).split(":", 1) - event_name = ":".join(splits[:2]).split("@")[0].strip() + event_name = x.split("@")[0].strip() + + event_dt = Time.from_str(y.split(":", 1)[-1], timezone="UTC") + + if event_dt.date() != now.date(): + continue if not (href := a.attributes.get("href")): continue @@ -67,6 +74,7 @@ async def get_events() -> list[dict[str, str]]: "sport": sport, "event": event_name, "link": urljoin(f"{html_data.url}", href), + "timestamp": now.timestamp(), } ) @@ -86,8 +94,6 @@ async def scrape() -> None: if events := await get_events(): log.info(f"Processing {len(events)} URL(s)") - now = Time.clean(Time.now()) - for i, ev in enumerate(events, start=1): handler = partial( process_event, @@ -102,7 +108,11 @@ async def scrape() -> None: log=log, ) - sport, event = ev["sport"], ev["event"] + sport, event, ts = ( + ev["sport"], + ev["event"], + ev["timestamp"], + ) key = f"[{sport}] {event} ({TAG})" @@ -112,7 +122,7 @@ async def scrape() -> None: "url": url, "logo": logo, "base": BASE_URL, - "timestamp": now.timestamp(), + "timestamp": ts, "id": tvg_id or "Live.Event.us", "link": link, } diff --git a/M3U8/scrapers/xstreameast.py b/M3U8/scrapers/xstreameast.py index cf768b1a..99c44441 100644 --- a/M3U8/scrapers/xstreameast.py +++ b/M3U8/scrapers/xstreameast.py @@ -97,7 +97,7 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]: if ( not (live_badge := card.css_first("span.bg-green-600")) - or live_badge.text(strip=True) != "LIVE" + or live_badge.text(strip=True).lower().strip() != "live" ): continue