mirror of
https://github.com/doms9/iptv.git
synced 2026-06-13 12:26:26 +02:00
e
- misc edits.
This commit is contained in:
parent
26bc13f1ec
commit
00000d927f
3 changed files with 21 additions and 28 deletions
|
|
@ -43,6 +43,9 @@ async def get_events() -> list[dict[str, str]]:
|
|||
if not (name := event.get("title")) or not (link := event.get("link")):
|
||||
continue
|
||||
|
||||
elif "drm.php" in link:
|
||||
continue
|
||||
|
||||
if (sport := event.get("category")) and sport == "Other":
|
||||
sport = "Live Event"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import asyncio
|
||||
import json
|
||||
import re
|
||||
from functools import partial
|
||||
from itertools import chain
|
||||
|
|
@ -71,7 +72,10 @@ async def process_event(url: str, url_num: int) -> tuple[str | None, str | None]
|
|||
log.warning(f"URL {url_num}) Failed to load iframe source. (IFR1)")
|
||||
return nones
|
||||
|
||||
valid_m3u8 = re.compile(r"(file|source):\s+(\'|\")([^\"]*)(\'|\")", re.I)
|
||||
valid_m3u8 = re.compile(
|
||||
r"(file|source|currentStreamUrl)\s*(:|=)\s+(\'|\")([^\"]*)(\'|\")",
|
||||
re.I,
|
||||
)
|
||||
|
||||
if not (match := valid_m3u8.search(ifr_src_data.text)):
|
||||
log.warning(f"URL {url_num}) No source found.")
|
||||
|
|
@ -79,7 +83,7 @@ async def process_event(url: str, url_num: int) -> tuple[str | None, str | None]
|
|||
|
||||
log.info(f"URL {url_num}) Captured M3U8")
|
||||
|
||||
return match[3], ifr_src
|
||||
return json.loads(f'"{match[4]}"'), ifr_src
|
||||
|
||||
|
||||
async def get_events() -> list[dict[str, str]]:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ast
|
||||
import base64
|
||||
import json
|
||||
import re
|
||||
from functools import partial
|
||||
|
||||
|
|
@ -13,41 +12,25 @@ TAG = "STP"
|
|||
|
||||
CACHE_FILE = Cache(TAG, exp=19_800)
|
||||
|
||||
API_URL = "https://streamtp-x-y-z.ws/eventos.json"
|
||||
API_URL = "https://streamtpday1.xyz/eventos.json"
|
||||
|
||||
|
||||
async def process_event(url: str, url_num: int) -> str | None:
|
||||
if not (event_data := await network.request(url, log=log)):
|
||||
if not (html_data := await network.request(url, log=log)):
|
||||
log.warning(f"URL {url_num}) Failed to load url.")
|
||||
return
|
||||
|
||||
digit_func_ptrn = re.compile(r"{return\s+(\d*);}", re.I)
|
||||
valid_m3u8 = re.compile(r'var\s+playbackURL\s+=\s+"([^"]*)"', re.I)
|
||||
|
||||
if not (digit_list := digit_func_ptrn.findall(event_data.text)):
|
||||
log.warning(f"URL {url_num}) Unable to decode url.")
|
||||
if not (match := valid_m3u8.search(html_data.text)):
|
||||
log.warning(f"URL {url_num}) No M3U8 found")
|
||||
return
|
||||
|
||||
embed_list_ptrn = re.compile(r"\w*=\[\[(.*)\]\];")
|
||||
|
||||
if not (embed_list := embed_list_ptrn.search(event_data.text)):
|
||||
log.warning(f"URL {url_num}) Unable to decode url.")
|
||||
return
|
||||
|
||||
embed_list_str = embed_list[0].split("=", 1)[-1].strip(";")
|
||||
|
||||
embed_list: list[tuple[int, str]] = ast.literal_eval(embed_list_str)
|
||||
|
||||
m3u8 = "".join(
|
||||
chr(
|
||||
int("".join(c for c in base64.b64decode(v).decode("utf-8") if c.isdigit()))
|
||||
- sum(map(int, digit_list))
|
||||
)
|
||||
for _, v in sorted(embed_list, key=lambda i: i[0])
|
||||
)
|
||||
|
||||
log.info(f"URL {url_num}) Captured M3U8")
|
||||
|
||||
return m3u8.split("ip=")[0]
|
||||
m3u8 = match[1].split("ip=")[0]
|
||||
|
||||
return json.loads(f'"{m3u8}"')
|
||||
|
||||
|
||||
async def get_events() -> list[dict[str, str]]:
|
||||
|
|
@ -63,6 +46,9 @@ async def get_events() -> list[dict[str, str]]:
|
|||
if not (name := event.get("title")) or not (link := event.get("link")):
|
||||
continue
|
||||
|
||||
elif "sudamericaplay" in link:
|
||||
continue
|
||||
|
||||
if (sport := event.get("category")) and sport == "Other":
|
||||
sport = "Live Event"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue