mirror of
https://github.com/doms9/iptv.git
synced 2026-04-21 19:46:59 +02:00
Compare commits
14 commits
cdc1ab64ab
...
0020bc9304
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0020bc9304 | ||
|
|
f08866e4e4 | ||
|
|
91ee7f7bdd | ||
|
|
dc84161bdc | ||
|
|
4685404b37 | ||
|
|
b32cc38f56 | ||
|
|
5ed68fd2ec | ||
|
|
3e22e50018 | ||
|
|
57b41175a8 | ||
|
|
00000d9854 | ||
|
|
63cf988d75 | ||
|
|
9fdf4c2345 | ||
|
|
1b75ff4991 | ||
|
|
178728a21d |
8 changed files with 123710 additions and 119061 deletions
3628
M3U8/TV.m3u8
3628
M3U8/TV.m3u8
File diff suppressed because it is too large
Load diff
235327
M3U8/TV.xml
235327
M3U8/TV.xml
File diff suppressed because one or more lines are too long
|
|
@ -73,7 +73,7 @@ https://cbsn-us.cbsnstream.cbsnews.com/out/v1/55a8648e8f134e82a470f83d562deeca/m
|
|||
https://dai.google.com/linear/hls/event/GxrCGmwST0ixsrc_QgB6qw/master.m3u8
|
||||
|
||||
#EXTINF:-1 tvg-chno="25" tvg-id="CBS.Sports.Network.HD.us2" tvg-name="CBS Sports Network" tvg-logo="http://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s16365_dark_360w_270h.png" group-title="TV",CBS Sports Network
|
||||
http://snowbank.houseinventer.com/7007/index.m3u8?token=c0lTeGc1M0gydFNjcloydGZhbTFsY1RYMkphdG5OcXdxNHpMeGFYWW5ZRERxNEduaVp1UnBxU2VlWmF0ZnRlRGxaMm1zNStDbnJOOXFZMlhtcStybmc9PQ==
|
||||
https://restream-live.realiptv.to/2879115/5077048/3712
|
||||
|
||||
#EXTINF:-1 tvg-chno="26" tvg-id="Cinemax.HD.us2" tvg-name="Cinemax" tvg-logo="https://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s34933_dark_360w_270h.png" group-title="TV",Cinemax
|
||||
http://23.237.104.106:8080/USA_CINEMAX/index.m3u8
|
||||
|
|
@ -136,7 +136,7 @@ http://23.237.104.106:8080/USA_DISNEY_XD/index.m3u8
|
|||
http://23.237.104.106:8080/USA_E/index.m3u8
|
||||
|
||||
#EXTINF:-1 tvg-chno="46" tvg-id="ESPN.HD.us2" tvg-name="ESPN" tvg-logo="http://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s10179_dark_360w_270h.png" group-title="TV",ESPN
|
||||
http://snowbank.houseinventer.com/6500/index.m3u8?token=M1lDdWljYkdyZGFhZzVxeGc2Mkt5OGJicWNxd2xheDkzWWVieEt5b3lZVERxNEduaVp1UnBxU2VlWmF0ZnRlRGxaMm1zNStDbnJOOXFZMlhtcStybmc9PQ==
|
||||
http://41.205.93.154/ESPN/index.m3u8
|
||||
|
||||
#EXTINF:-1 tvg-chno="47" tvg-id="ESPNEWS.HD.us2" tvg-name="ESPN News" tvg-logo="http://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s16485_dark_360w_270h.png" group-title="TV",ESPN News
|
||||
https://starshare.st/live/P4B9TB9xR8/humongous2tonight/1003.ts
|
||||
|
|
@ -145,7 +145,7 @@ https://starshare.st/live/P4B9TB9xR8/humongous2tonight/1003.ts
|
|||
http://23.237.104.106:8080/USA_ESPNU/index.m3u8
|
||||
|
||||
#EXTINF:-1 tvg-chno="49" tvg-id="ESPN2.HD.us2" tvg-name="ESPN2" tvg-logo="http://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s12444_dark_360w_270h.png" group-title="TV",ESPN2
|
||||
http://snowbank.houseinventer.com/6501/index.m3u8?token=M1lDdWljYkdyZGFhZzVxeGc2Mkt5OGJicWNxd2xheDkzWWVieEt5b3lZVERxNEduaVp1UnBxU2VlWmF0ZnRlRGxaMm1zNStDbnJOOXFZMlhtcStybmc9PQ==
|
||||
https://restream-live.realiptv.to/2879115/5077048/2581
|
||||
|
||||
#EXTINF:-1 tvg-chno="50" tvg-id="FanDuel.Sports.Network.Detroit.HD.us" tvg-name="FDSN Detroit" tvg-logo="https://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s54286_dark_360w_270h.png" group-title="TV",FDSN Detroit
|
||||
http://mytvstream.net:8080/live/30550113/30550113/20930.m3u8
|
||||
|
|
@ -229,7 +229,7 @@ http://mytvstream.net:8080/live/30550113/30550113/120633.m3u8
|
|||
http://mytvstream.net:8080/live/30550113/30550113/18366.m3u8
|
||||
|
||||
#EXTINF:-1 tvg-chno="77" tvg-id="Golf.Channel.HD.us2" tvg-name="Golf Channel" tvg-logo="http://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s14899_dark_360w_270h.png" group-title="TV",Golf Channel
|
||||
https://starshare.st/live/P4B9TB9xR8/humongous2tonight/3294.ts
|
||||
http://mytvstream.net:8080/live/30550113/30550113/9806.m3u8
|
||||
|
||||
#EXTINF:-1 tvg-chno="78" tvg-id="Grit.us2" tvg-name="Grit TV" tvg-logo="http://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s89922_dark_360w_270h.png" group-title="TV",Grit TV
|
||||
http://mytvstream.net:8080/live/30550113/30550113/20861.m3u8
|
||||
|
|
|
|||
3620
M3U8/events.m3u8
3620
M3U8/events.m3u8
File diff suppressed because it is too large
Load diff
|
|
@ -70,7 +70,7 @@ async def main() -> None:
|
|||
asyncio.create_task(streamcenter.scrape(hdl_brwsr)),
|
||||
asyncio.create_task(streamhub.scrape(xtrnl_brwsr)),
|
||||
asyncio.create_task(streamsgate.scrape(xtrnl_brwsr)),
|
||||
# asyncio.create_task(timstreams.scrape(xtrnl_brwsr)),
|
||||
asyncio.create_task(timstreams.scrape(xtrnl_brwsr)),
|
||||
]
|
||||
|
||||
httpx_tasks = [
|
||||
|
|
|
|||
|
|
@ -35,9 +35,7 @@ SPORT_URLS = {
|
|||
|
||||
|
||||
async def refresh_html_cache(
|
||||
url: str,
|
||||
sport: str,
|
||||
now_ts: float,
|
||||
url: str, now_ts: float
|
||||
) -> dict[str, dict[str, str | float]]:
|
||||
|
||||
events = {}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
import asyncio
|
||||
from functools import partial
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from playwright.async_api import Browser, Page, Response
|
||||
from selectolax.parser import HTMLParser
|
||||
from playwright.async_api import Browser
|
||||
|
||||
from .utils import Cache, Time, get_logger, leagues, network
|
||||
|
||||
|
|
@ -15,6 +13,10 @@ TAG = "TIMSTRMS"
|
|||
|
||||
CACHE_FILE = Cache(TAG, exp=10_800)
|
||||
|
||||
API_FILE = Cache(f"{TAG}-api", exp=19_800)
|
||||
|
||||
API_URL = "https://timstreams.fit/api/live-upcoming"
|
||||
|
||||
BASE_URL = "https://timstreams.fit"
|
||||
|
||||
SPORT_GENRES = {
|
||||
|
|
@ -38,137 +40,57 @@ SPORT_GENRES = {
|
|||
}
|
||||
|
||||
|
||||
def sift_xhr(resp: Response) -> bool:
|
||||
resp_url = resp.url
|
||||
|
||||
return "hmembeds.one/embed" in resp_url and resp.status == 200
|
||||
|
||||
|
||||
async def process_event(
|
||||
url: str,
|
||||
url_num: int,
|
||||
page: Page,
|
||||
) -> tuple[str | None, str | None]:
|
||||
|
||||
nones = None, None
|
||||
|
||||
captured: list[str] = []
|
||||
|
||||
got_one = asyncio.Event()
|
||||
|
||||
handler = partial(
|
||||
network.capture_req,
|
||||
captured=captured,
|
||||
got_one=got_one,
|
||||
)
|
||||
|
||||
page.on("request", handler)
|
||||
|
||||
try:
|
||||
try:
|
||||
async with page.expect_response(sift_xhr, timeout=3_000) as strm_resp:
|
||||
resp = await page.goto(
|
||||
url,
|
||||
wait_until="domcontentloaded",
|
||||
timeout=6_000,
|
||||
)
|
||||
|
||||
if not resp or resp.status != 200:
|
||||
log.warning(
|
||||
f"URL {url_num}) Status Code: {resp.status if resp else 'None'}"
|
||||
)
|
||||
|
||||
return nones
|
||||
|
||||
response = await strm_resp.value
|
||||
|
||||
embed_url = response.url
|
||||
except TimeoutError:
|
||||
log.warning(f"URL {url_num}) No available stream links.")
|
||||
|
||||
return nones
|
||||
|
||||
wait_task = asyncio.create_task(got_one.wait())
|
||||
|
||||
try:
|
||||
await asyncio.wait_for(wait_task, timeout=6)
|
||||
except asyncio.TimeoutError:
|
||||
log.warning(f"URL {url_num}) Timed out waiting for M3U8.")
|
||||
|
||||
return nones
|
||||
|
||||
finally:
|
||||
if not wait_task.done():
|
||||
wait_task.cancel()
|
||||
|
||||
try:
|
||||
await wait_task
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
|
||||
if captured:
|
||||
log.info(f"URL {url_num}) Captured M3U8")
|
||||
|
||||
return captured[0], embed_url
|
||||
|
||||
log.warning(f"URL {url_num}) No M3U8 captured after waiting.")
|
||||
|
||||
return nones
|
||||
|
||||
except Exception as e:
|
||||
log.warning(f"URL {url_num}) {e}")
|
||||
|
||||
return nones
|
||||
|
||||
finally:
|
||||
page.remove_listener("request", handler)
|
||||
|
||||
|
||||
async def get_events(cached_keys: list[str]) -> list[dict[str, str]]:
|
||||
now = Time.clean(Time.now())
|
||||
|
||||
if not (api_data := API_FILE.load(per_entry=False)):
|
||||
log.info("Refreshing API cache")
|
||||
|
||||
api_data = {"timestamp": now.timestamp()}
|
||||
|
||||
if r := await network.request(API_URL, log=log):
|
||||
api_data: dict = r.json()
|
||||
|
||||
api_data["timestamp"] = now.timestamp()
|
||||
|
||||
API_FILE.write(api_data)
|
||||
|
||||
events = []
|
||||
|
||||
if not (html_data := await network.request(BASE_URL, log=log)):
|
||||
return events
|
||||
start_dt = now.delta(minutes=-30)
|
||||
end_dt = now.delta(minutes=30)
|
||||
|
||||
soup = HTMLParser(html_data.content)
|
||||
|
||||
for card in soup.css("#eventsSection .card"):
|
||||
card_attrs = card.attributes
|
||||
|
||||
if not (sport_id := card_attrs.get("data-genre")):
|
||||
for info in api_data.get("events", []):
|
||||
if (genre := info.get("genre", 999)) not in SPORT_GENRES:
|
||||
continue
|
||||
|
||||
elif not (sport := SPORT_GENRES.get(int(sport_id))):
|
||||
event_dt = Time.from_str(info["time"], timezone="EST")
|
||||
|
||||
if not start_dt <= event_dt <= end_dt:
|
||||
continue
|
||||
|
||||
if not (event_name := card_attrs.get("data-search")):
|
||||
name: str = info["name"]
|
||||
|
||||
url_id: str = info["url"]
|
||||
|
||||
logo: str | None = info.get("logo")
|
||||
|
||||
sport = SPORT_GENRES[genre]
|
||||
|
||||
if f"[{sport}] {name} ({TAG})" in cached_keys:
|
||||
continue
|
||||
|
||||
if f"[{sport}] {event_name} ({TAG})" in cached_keys:
|
||||
if not (streams := info.get("streams")) or not (url := streams[0].get("url")):
|
||||
continue
|
||||
|
||||
if not (badge_elem := card.css_first(".badge")):
|
||||
continue
|
||||
|
||||
if "data-countdown" in badge_elem.attributes:
|
||||
continue
|
||||
|
||||
if (not (watch_btn := card.css_first("a.btn-watch"))) or (
|
||||
not (href := watch_btn.attributes.get("href"))
|
||||
):
|
||||
continue
|
||||
|
||||
logo = None
|
||||
|
||||
if card_thumb := card.css_first(".card-thumb img"):
|
||||
logo = card_thumb.attributes.get("src")
|
||||
|
||||
events.append(
|
||||
{
|
||||
"sport": sport,
|
||||
"event": event_name,
|
||||
"link": urljoin(BASE_URL, href),
|
||||
"event": name,
|
||||
"link": urljoin(BASE_URL, f"watch/{url_id}"),
|
||||
"ref": url,
|
||||
"logo": logo,
|
||||
"timestamp": event_dt.timestamp(),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -191,29 +113,30 @@ async def scrape(browser: Browser) -> None:
|
|||
if events := await get_events(cached_urls.keys()):
|
||||
log.info(f"Processing {len(events)} new URL(s)")
|
||||
|
||||
now = Time.clean(Time.now())
|
||||
|
||||
async with network.event_context(browser, stealth=False) as context:
|
||||
for i, ev in enumerate(events, start=1):
|
||||
async with network.event_page(context) as page:
|
||||
handler = partial(
|
||||
process_event,
|
||||
network.process_event,
|
||||
url=(link := ev["link"]),
|
||||
url_num=i,
|
||||
page=page,
|
||||
log=log,
|
||||
)
|
||||
|
||||
url, iframe = await network.safe_process(
|
||||
url = await network.safe_process(
|
||||
handler,
|
||||
url_num=i,
|
||||
semaphore=network.PW_S,
|
||||
log=log,
|
||||
)
|
||||
|
||||
sport, event, logo = (
|
||||
sport, event, logo, ref, ts = (
|
||||
ev["sport"],
|
||||
ev["event"],
|
||||
ev["logo"],
|
||||
ev["ref"],
|
||||
ev["timestamp"],
|
||||
)
|
||||
|
||||
key = f"[{sport}] {event} ({TAG})"
|
||||
|
|
@ -223,8 +146,8 @@ async def scrape(browser: Browser) -> None:
|
|||
entry = {
|
||||
"url": url,
|
||||
"logo": logo or pic,
|
||||
"base": iframe,
|
||||
"timestamp": now.timestamp(),
|
||||
"base": ref,
|
||||
"timestamp": ts,
|
||||
"id": tvg_id or "Live.Event.us",
|
||||
"link": link,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
## Base Log @ 2026-03-15 09:00 UTC
|
||||
## Base Log @ 2026-03-16 09:38 UTC
|
||||
|
||||
### ✅ Working Streams: 153<br>❌ Dead Streams: 8
|
||||
### ✅ Working Streams: 156<br>❌ Dead Streams: 5
|
||||
|
||||
| Channel | Error (Code) | Link |
|
||||
| ------- | ------------ | ---- |
|
||||
| Altitude Sports | HTTP Error (403) | `http://mytvstream.net:8080/live/30550113/30550113/79545.m3u8` |
|
||||
| CBS Sports Network | HTTP Error (403) | `http://snowbank.houseinventer.com/7007/index.m3u8?token=c0lTeGc1M0gydFNjcloydGZhbTFsY1RYMkphdG5OcXdxNHpMeGFYWW5ZRERxNEduaVp1UnBxU2VlWmF0ZnRlRGxaMm1zNStDbnJOOXFZMlhtcStybmc9PQ==` |
|
||||
| ESPN | HTTP Error (403) | `http://snowbank.houseinventer.com/6500/index.m3u8?token=M1lDdWljYkdyZGFhZzVxeGc2Mkt5OGJicWNxd2xheDkzWWVieEt5b3lZVERxNEduaVp1UnBxU2VlWmF0ZnRlRGxaMm1zNStDbnJOOXFZMlhtcStybmc9PQ==` |
|
||||
| ESPN2 | HTTP Error (403) | `http://snowbank.houseinventer.com/6501/index.m3u8?token=M1lDdWljYkdyZGFhZzVxeGc2Mkt5OGJicWNxd2xheDkzWWVieEt5b3lZVERxNEduaVp1UnBxU2VlWmF0ZnRlRGxaMm1zNStDbnJOOXFZMlhtcStybmc9PQ==` |
|
||||
| Game Show Network | HTTP Error (403) | `http://mytvstream.net:8080/live/30550113/30550113/120633.m3u8` |
|
||||
| HBO Family | HTTP Error (403) | `http://mytvstream.net:8080/live/30550113/30550113/17772.m3u8` |
|
||||
| Hallmark Family | HTTP Error (403) | `http://mytvstream.net:8080/live/30550113/30550113/9307.m3u8` |
|
||||
| NBC Sports California | HTTP Error (403) | `http://mytvstream.net:8080/live/30550113/30550113/20940.m3u8` |
|
||||
| NHL Network | HTTP Error (000) | `http://mytvstream.net:8080/live/30550113/30550113/20179.m3u8` |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue