mirror of
https://github.com/doms9/iptv.git
synced 2026-03-08 11:28:34 +01:00
e
This commit is contained in:
parent
530fe3e562
commit
00000d9895
14 changed files with 25 additions and 34 deletions
|
|
@ -19,7 +19,7 @@ BASE_URL = "http://www.fawanews.sc/"
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> str | None:
|
async def process_event(url: str, url_num: int) -> str | None:
|
||||||
if not (html_data := await network.request(url, log=log)):
|
if not (html_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ BASE_URL = "https://istreameast.app"
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> str | None:
|
async def process_event(url: str, url_num: int) -> str | None:
|
||||||
if not (event_data := await network.request(url, log=log)):
|
if not (event_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (iframe_src_data := await network.request(iframe_src, log=log)):
|
if not (iframe_src_data := await network.request(iframe_src, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load iframe source.")
|
log.warning(f"URL {url_num}) Failed to load iframe source.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,6 @@ async def process_event(
|
||||||
page: Page,
|
page: Page,
|
||||||
) -> str | None:
|
) -> str | None:
|
||||||
|
|
||||||
event_id_pattern = re.compile(r"&c=(\d*)", re.I)
|
|
||||||
|
|
||||||
captured: list[str] = []
|
captured: list[str] = []
|
||||||
|
|
||||||
got_one = asyncio.Event()
|
got_one = asyncio.Event()
|
||||||
|
|
@ -82,14 +80,7 @@ async def process_event(
|
||||||
log.warning(f"URL {url_num}) No valid sources found.")
|
log.warning(f"URL {url_num}) No valid sources found.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if (match := event_id_pattern.search(href)) and (
|
event_url = href if href.startswith("http") else f"https:{href}"
|
||||||
event_id := match[1]
|
|
||||||
).isalnum():
|
|
||||||
|
|
||||||
event_url = f"https://aliez.tv/player/live.php?id={event_id}"
|
|
||||||
|
|
||||||
else:
|
|
||||||
event_url = href if href.startswith("http") else f"https:{href}"
|
|
||||||
|
|
||||||
await page.goto(
|
await page.goto(
|
||||||
event_url,
|
event_url,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ async def process_event(url: str, url_num: int) -> tuple[str | None, str | None]
|
||||||
nones = None, None
|
nones = None, None
|
||||||
|
|
||||||
if not (html_data := await network.request(url, log=log)):
|
if not (html_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
return nones
|
return nones
|
||||||
|
|
||||||
soup = HTMLParser(html_data.content)
|
soup = HTMLParser(html_data.content)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ BASE_URL = "https://pawastreams.net/feed/"
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> str | None:
|
async def process_event(url: str, url_num: int) -> str | None:
|
||||||
if not (event_data := await network.request(url, log=log)):
|
if not (event_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (iframe_src_data := await network.request(iframe_src, log=log)):
|
if not (iframe_src_data := await network.request(iframe_src, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load iframe source.")
|
log.warning(f"URL {url_num}) Failed to load iframe source.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@ BASE_URL = "https://sharkstreams.net"
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> str | None:
|
async def process_event(url: str, url_num: int) -> str | None:
|
||||||
if not (r := await network.request(url, log=log)):
|
if not (r := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
data: dict[str, list[str]] = r.json()
|
data: dict[str, list[str]] = r.json()
|
||||||
|
|
||||||
if not (urls := data.get("urls")):
|
if not (urls := data.get("urls")):
|
||||||
log.info(f"URL {url_num}) No M3U8 found")
|
log.warning(f"URL {url_num}) No M3U8 found")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -39,8 +39,6 @@ async def process_event(url: str, url_num: int) -> str | None:
|
||||||
|
|
||||||
|
|
||||||
async def refresh_html_cache(now_ts: float) -> dict[str, dict[str, str | float]]:
|
async def refresh_html_cache(now_ts: float) -> dict[str, dict[str, str | float]]:
|
||||||
log.info("Refreshing HTML cache")
|
|
||||||
|
|
||||||
events = {}
|
events = {}
|
||||||
|
|
||||||
if not (html_data := await network.request(BASE_URL, log=log)):
|
if not (html_data := await network.request(BASE_URL, log=log)):
|
||||||
|
|
@ -92,6 +90,8 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]:
|
||||||
now = Time.clean(Time.now())
|
now = Time.clean(Time.now())
|
||||||
|
|
||||||
if not (events := HTML_CACHE.load()):
|
if not (events := HTML_CACHE.load()):
|
||||||
|
log.info("Refreshing HTML cache")
|
||||||
|
|
||||||
events = await refresh_html_cache(now.timestamp())
|
events = await refresh_html_cache(now.timestamp())
|
||||||
|
|
||||||
HTML_CACHE.write(events)
|
HTML_CACHE.write(events)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
||||||
valid_m3u8 = re.compile(r'var\s+(\w+)\s*=\s*"([^"]*)"', re.I)
|
valid_m3u8 = re.compile(r'var\s+(\w+)\s*=\s*"([^"]*)"', re.I)
|
||||||
|
|
||||||
if not (match := valid_m3u8.search(html_data.text)):
|
if not (match := valid_m3u8.search(html_data.text)):
|
||||||
log.info(f"URL {url_num}) No M3U8 found")
|
log.warning(f"URL {url_num}) No M3U8 found")
|
||||||
return
|
return
|
||||||
|
|
||||||
stream_link: str = match[2]
|
stream_link: str = match[2]
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,6 @@ def get_event(t1: str, t2: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
async def refresh_api_cache(now_ts: float) -> list[dict[str, Any]]:
|
async def refresh_api_cache(now_ts: float) -> list[dict[str, Any]]:
|
||||||
log.info("Refreshing API cache")
|
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
network.request(
|
network.request(
|
||||||
urljoin(BASE_URL, f"data/{sport}.json"),
|
urljoin(BASE_URL, f"data/{sport}.json"),
|
||||||
|
|
@ -73,6 +71,8 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]:
|
||||||
now = Time.clean(Time.now())
|
now = Time.clean(Time.now())
|
||||||
|
|
||||||
if not (api_data := API_FILE.load(per_entry=False, index=-1)):
|
if not (api_data := API_FILE.load(per_entry=False, index=-1)):
|
||||||
|
log.info("Refreshing API cache")
|
||||||
|
|
||||||
api_data = await refresh_api_cache(now.timestamp())
|
api_data = await refresh_api_cache(now.timestamp())
|
||||||
|
|
||||||
API_FILE.write(api_data)
|
API_FILE.write(api_data)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ def fix_txt(s: str) -> str:
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> str | None:
|
async def process_event(url: str, url_num: int) -> str | None:
|
||||||
if not (event_data := await network.request(url, log=log)):
|
if not (event_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (iframe_1_src_data := await network.request(iframe_1_src, log=log)):
|
if not (iframe_1_src_data := await network.request(iframe_1_src, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load iframe source.")
|
log.warning(f"URL {url_num}) Failed to load iframe source.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
||||||
headers={"Referer": iframe_1_src},
|
headers={"Referer": iframe_1_src},
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
log.info(f"URL {url_num}) Failed to load iframe source.")
|
log.warning(f"URL {url_num}) Failed to load iframe source.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ BASE_URL = "https://thetvapp.to"
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> str | None:
|
async def process_event(url: str, url_num: int) -> str | None:
|
||||||
if not (html_data := await network.request(url, log=log)):
|
if not (html_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ def fix_event(s: str) -> str:
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> str | None:
|
async def process_event(url: str, url_num: int) -> str | None:
|
||||||
if not (event_data := await network.request(url, log=log)):
|
if not (event_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
||||||
log=log,
|
log=log,
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
log.info(f"URL {url_num}) Failed to load iframe source.")
|
log.warning(f"URL {url_num}) Failed to load iframe source.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,6 @@ VALID_SPORTS = [
|
||||||
|
|
||||||
|
|
||||||
async def refresh_api_cache(now: Time) -> list[dict[str, Any]]:
|
async def refresh_api_cache(now: Time) -> list[dict[str, Any]]:
|
||||||
log.info("Refreshing API cache")
|
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
network.request(
|
network.request(
|
||||||
urljoin(API_URL, "api/v1/matches/all"),
|
urljoin(API_URL, "api/v1/matches/all"),
|
||||||
|
|
@ -175,6 +173,8 @@ async def get_events(base_url: str, cached_keys: list[str]) -> list[dict[str, st
|
||||||
now = Time.clean(Time.now())
|
now = Time.clean(Time.now())
|
||||||
|
|
||||||
if not (api_data := API_FILE.load(per_entry=False, index=-1)):
|
if not (api_data := API_FILE.load(per_entry=False, index=-1)):
|
||||||
|
log.info("Refreshing API cache")
|
||||||
|
|
||||||
api_data = await refresh_api_cache(now)
|
api_data = await refresh_api_cache(now)
|
||||||
|
|
||||||
API_FILE.write(api_data)
|
API_FILE.write(api_data)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ def fix_event(s: str) -> str:
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> str | None:
|
async def process_event(url: str, url_num: int) -> str | None:
|
||||||
if not (event_data := await network.request(url, log=log)):
|
if not (event_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
||||||
log=log,
|
log=log,
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
log.info(f"URL {url_num}) Failed to load iframe source.")
|
log.warning(f"URL {url_num}) Failed to load iframe source.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ async def process_event(url: str, url_num: int) -> tuple[str | None, str | None]
|
||||||
nones = None, None
|
nones = None, None
|
||||||
|
|
||||||
if not (html_data := await network.request(url, log=log)):
|
if not (html_data := await network.request(url, log=log)):
|
||||||
log.info(f"URL {url_num}) Failed to load url.")
|
log.warning(f"URL {url_num}) Failed to load url.")
|
||||||
return nones
|
return nones
|
||||||
|
|
||||||
soup = HTMLParser(html_data.content)
|
soup = HTMLParser(html_data.content)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue