This commit is contained in:
doms9 2025-09-13 13:32:32 -04:00
parent 21f39fb5a0
commit 00000d9000
7 changed files with 37 additions and 44 deletions

View file

@ -114,10 +114,7 @@ async def main(client: httpx.AsyncClient) -> None:
urls[f"[{sport}] {event} (S{i})"] = { urls[f"[{sport}] {event} (S{i})"] = {
"url": link, "url": link,
"logo": LOGOS.get( "logo": LOGOS.get(sport, LOGOS["default"]),
sport,
"https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
),
} }
log.info(f"Collected {len(urls)} events") log.info(f"Collected {len(urls)} events")

View file

@ -41,23 +41,24 @@ async def get_events(
events = [] events = []
for wrpr in soup.css("div.fixtures-live-wrapper"): for wrpr in soup.css("div.fixtures-live-wrapper"):
for games in wrpr.css(".match-table-item"): for league_block in wrpr.css(".match-table-item > .league-info-wrapper"):
if not (
league_name_el := league_block.css_first(".league-info a.league-name")
):
continue
league_name = games.css_first(".league-info a.league-name") full_text = league_name_el.text(strip=True)
league_match = games.css_first(".common-table-row a[href*='/match/']")
if league_name and league_match:
full_text = league_name.text(strip=True)
if "]" in full_text: if "]" in full_text:
event_name = full_text.split("]", 1)[1].strip() event_name = full_text.split("]", 1)[1].strip()
else: else:
event_name = full_text event_name = full_text
href = league_match.attributes.get("href") parent_item = league_block.parent
link = urljoin(base_url, href) for game in parent_item.css(".common-table-row a[href*='/match/']"):
if not (href := game.attributes.get("href")):
continue
if cached_hrefs & {href}: if cached_hrefs & {href}:
continue continue
@ -65,11 +66,8 @@ async def get_events(
events.append( events.append(
{ {
"sport": event_name, "sport": event_name,
"link": link, "link": urljoin(base_url, href),
"logo": LOGOS.get( "logo": LOGOS.get(event_name, LOGOS["default"]),
event_name,
"https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
),
"href": href, "href": href,
} }
) )
@ -103,14 +101,14 @@ async def process_event(
og_title.attributes.get("content", "").split(" start on")[0].strip() og_title.attributes.get("content", "").split(" start on")[0].strip()
) )
if ifr := soup.css_first("iframe"): if not (ifr := soup.css_first("iframe")):
log.info(f"URL {url_num}) No M3U8 found")
return "", ""
if src := ifr.attributes.get("src", ""): if src := ifr.attributes.get("src", ""):
log.info(f"URL {url_num}) Captured M3U8") log.info(f"URL {url_num}) Captured M3U8")
return match_name, unquote(src).split("link=")[-1] return match_name, unquote(src).split("link=")[-1]
log.info(f"URL {url_num}) No M3U8 found")
return "", ""
async def main(client: httpx.AsyncClient) -> None: async def main(client: httpx.AsyncClient) -> None:
cached_urls = load_cache(CACHE_FILE, exp=14400) cached_urls = load_cache(CACHE_FILE, exp=14400)

View file

@ -310,10 +310,7 @@ async def main(client: httpx.AsyncClient) -> None:
if url: if url:
entry = { entry = {
"url": url, "url": url,
"logo": LOGOS.get( "logo": LOGOS.get(sport, LOGOS["default"]),
sport,
"https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
),
"base": "https://livetv.sx/enx/", "base": "https://livetv.sx/enx/",
"timestamp": now.timestamp(), "timestamp": now.timestamp(),
} }

View file

@ -12,6 +12,7 @@ import httpx
from playwright.async_api import async_playwright from playwright.async_api import async_playwright
from .utils import ( from .utils import (
LOGOS,
TZ, TZ,
capture_req, capture_req,
firefox, firefox,
@ -138,10 +139,7 @@ async def get_events(
event["name"], event["name"],
event["starts_at"], event["starts_at"],
event["ends_at"], event["ends_at"],
event.get( event.get("poster", LOGOS["default"]),
"poster",
"https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
),
event["uri_name"], event["uri_name"],
) )

View file

@ -149,10 +149,7 @@ async def get_events(
"sport": sport, "sport": sport,
"event": name, "event": name,
"link": href, "link": href,
"logo": LOGOS.get( "logo": LOGOS.get(sport, LOGOS["default"]),
sport,
"https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
),
} }
) )

View file

@ -55,10 +55,7 @@ async def main(client: httpx.AsyncClient) -> None:
entry = { entry = {
"url": f"http://origin.thetvapp.to/hls/{url.split('/')[-2]}/mono.m3u8", "url": f"http://origin.thetvapp.to/hls/{url.split('/')[-2]}/mono.m3u8",
"logo": LOGOS.get( "logo": LOGOS.get(sport, LOGOS["default"]),
sport,
"https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
),
"base": "https://tvpass.org", "base": "https://tvpass.org",
"timestamp": now.timestamp(), "timestamp": now.timestamp(),
} }

View file

@ -22,6 +22,7 @@ UA = (
) )
LOGOS = { LOGOS = {
"default": "https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
"MLB": "https://i.gyazo.com/0fe7865ef2f06c9507791b24f04dbca8.png", "MLB": "https://i.gyazo.com/0fe7865ef2f06c9507791b24f04dbca8.png",
"NBA": "https://i.gyazo.com/773c23570f095a5d549c23b9401d83f4.png", "NBA": "https://i.gyazo.com/773c23570f095a5d549c23b9401d83f4.png",
"NCAAF": "https://i.gyazo.com/ca63b40c86e757436de9d34d369b24f8.png", "NCAAF": "https://i.gyazo.com/ca63b40c86e757436de9d34d369b24f8.png",
@ -29,7 +30,15 @@ LOGOS = {
"NFL": "https://i.gyazo.com/fb4956d7a2fe54a1bac54cd81e1b3f11.png", "NFL": "https://i.gyazo.com/fb4956d7a2fe54a1bac54cd81e1b3f11.png",
"NHL": "https://i.gyazo.com/526607d4e886d5ed1fecca4bff3115e2.png", "NHL": "https://i.gyazo.com/526607d4e886d5ed1fecca4bff3115e2.png",
"WNBA": "https://i.gyazo.com/02d665a5704118d195dbcd5fa20d5462.png", "WNBA": "https://i.gyazo.com/02d665a5704118d195dbcd5fa20d5462.png",
"La Liga": "https://i.gyazo.com/3ea07074f7faab98c00493f07f4c6661.png",
"Premier League": "https://i.gyazo.com/5cf939a9669647ec49c5ca61ab34789d.png",
"Serie A": "https://i.gyazo.com/38fd8ea613b0f02780d2314fd49f7595.png",
"Bundesliga": "https://i.gyazo.com/d608cd1fe95c288aba9e03a9b2f2b688.png",
"Ligue 1": "https://i.gyazo.com/e5cd3f3960ea0fc7a10f831b6c79d31d.png",
"Primeira Liga": "https://i.gyazo.com/0b9ff26408609ccb90bf45d60aa13500.png",
"MLS": "https://i.gyazo.com/014b639a369d2bd8a4b97d00a239f330.png",
} }
LOGOS["EPL"] = LOGOS["Premier League"]
LOG_FMT = ( LOG_FMT = (
"[%(asctime)s] " "[%(asctime)s] "