update M3U8

This commit is contained in:
GitHub Actions Bot 2026-06-07 14:00:42 -04:00
parent e2edcd09c7
commit 79d60bad2f
4 changed files with 574 additions and 681 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,6 @@ from scrapers import (
streamsgate,
streamtpnew,
totalsportek,
tvapp,
watchfooty,
webcast,
xyzstream,
@ -71,7 +70,6 @@ async def main() -> None:
asyncio.create_task(streamsgate.scrape()),
asyncio.create_task(streamtpnew.scrape()),
asyncio.create_task(totalsportek.scrape()),
# asyncio.create_task(tvapp.scrape()),
asyncio.create_task(webcast.scrape()),
asyncio.create_task(xyzstream.scrape()),
]
@ -102,7 +100,6 @@ async def main() -> None:
| streamsgate.urls
| streamtpnew.urls
| totalsportek.urls
| tvapp.urls
| watchfooty.urls
| webcast.urls
| xyzstream.urls

View file

@ -1,140 +0,0 @@
from functools import partial
from urllib.parse import urljoin
from selectolax.parser import HTMLParser
from .utils import Cache, Time, get_logger, leagues, network
log = get_logger(__name__)
urls: dict[str, dict[str, str | float]] = {}
TAG = "TVAPP"
CACHE_FILE = Cache(TAG, exp=86_400)
BASE_URL = "https://thetvapp.to"
async def process_event(url: str, url_num: int) -> str | None:
if not (html_data := await network.request(url, log=log)):
log.warning(f"URL {url_num}) Failed to load url.")
return
soup = HTMLParser(html_data.content)
if not (channel_name_elem := soup.css_first("#stream_name")):
log.warning(f"URL {url_num}) No channel name elem found.")
return
if not (channel_name := channel_name_elem.attributes.get("name")):
log.warning(f"URL {url_num}) No channel name found.")
return
log.info(f"URL {url_num}) Captured M3U8")
return f"https://tvpass.org/live/{channel_name.strip()}/sd"
async def get_events() -> list[dict[str, str]]:
events = []
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"):
if not (h3_elem := row.css_first("h3")):
continue
if (sport := h3_elem.text(strip=True)).lower() == "live tv channels":
continue
for a in row.css("a.list-group-item[href]"):
x, y = a.text(strip=True).split(":", 1)
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
events.append(
{
"sport": sport,
"event": event_name,
"link": urljoin(f"{html_data.url}", href),
"timestamp": now.timestamp(),
}
)
return events
async def scrape() -> None:
if cached_urls := CACHE_FILE.load():
urls.update({k: v for k, v in cached_urls.items() if v["url"]})
log.info(f"Loaded {len(urls)} event(s) from cache")
return
log.info(f'Scraping from "{BASE_URL}"')
if events := await get_events():
log.info(f"Processing {len(events)} URL(s)")
for i, ev in enumerate(events, start=1):
handler = partial(
process_event,
url=(link := ev["link"]),
url_num=i,
)
url = await network.safe_process(
handler,
url_num=i,
semaphore=network.HTTP_S,
log=log,
)
sport, event, ts = (
ev["sport"],
ev["event"],
ev["timestamp"],
)
key = f"[{sport}] {event} ({TAG})"
tvg_id, logo = leagues.get_tvg_info(sport, event)
entry = {
"url": url,
"logo": logo,
"base": BASE_URL,
"timestamp": ts,
"id": tvg_id or "Live.Event.us",
"link": link,
}
cached_urls[key] = entry
if url:
urls[key] = entry
log.info(f"Collected and cached {len(urls)} event(s)")
else:
log.info("No events found")
CACHE_FILE.write(cached_urls)