mirror of
https://github.com/doms9/iptv.git
synced 2026-03-07 11:18:25 +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:
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ BASE_URL = "https://istreameast.app"
|
|||
|
||||
async def process_event(url: str, url_num: int) -> str | None:
|
||||
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
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
|||
return
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@ async def process_event(
|
|||
page: Page,
|
||||
) -> str | None:
|
||||
|
||||
event_id_pattern = re.compile(r"&c=(\d*)", re.I)
|
||||
|
||||
captured: list[str] = []
|
||||
|
||||
got_one = asyncio.Event()
|
||||
|
|
@ -82,14 +80,7 @@ async def process_event(
|
|||
log.warning(f"URL {url_num}) No valid sources found.")
|
||||
return
|
||||
|
||||
if (match := event_id_pattern.search(href)) and (
|
||||
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}"
|
||||
event_url = href if href.startswith("http") else f"https:{href}"
|
||||
|
||||
await page.goto(
|
||||
event_url,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ async def process_event(url: str, url_num: int) -> tuple[str | None, str | None]
|
|||
nones = None, None
|
||||
|
||||
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
|
||||
|
||||
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:
|
||||
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
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
|||
return
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ BASE_URL = "https://sharkstreams.net"
|
|||
|
||||
async def process_event(url: str, url_num: int) -> str | None:
|
||||
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
|
||||
|
||||
data: dict[str, list[str]] = r.json()
|
||||
|
||||
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
|
||||
|
||||
|
|
@ -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]]:
|
||||
log.info("Refreshing HTML cache")
|
||||
|
||||
events = {}
|
||||
|
||||
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())
|
||||
|
||||
if not (events := HTML_CACHE.load()):
|
||||
log.info("Refreshing HTML cache")
|
||||
|
||||
events = await refresh_html_cache(now.timestamp())
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
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]]:
|
||||
log.info("Refreshing API cache")
|
||||
|
||||
tasks = [
|
||||
network.request(
|
||||
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())
|
||||
|
||||
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_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:
|
||||
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
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
|||
return
|
||||
|
||||
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
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ 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.info(f"URL {url_num}) Failed to load url.")
|
||||
log.warning(f"URL {url_num}) Failed to load url.")
|
||||
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ def fix_event(s: str) -> str:
|
|||
|
||||
async def process_event(url: str, url_num: int) -> str | None:
|
||||
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
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ VALID_SPORTS = [
|
|||
|
||||
|
||||
async def refresh_api_cache(now: Time) -> list[dict[str, Any]]:
|
||||
log.info("Refreshing API cache")
|
||||
|
||||
tasks = [
|
||||
network.request(
|
||||
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())
|
||||
|
||||
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_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:
|
||||
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
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ async def process_event(url: str, url_num: int) -> str | None:
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ async def process_event(url: str, url_num: int) -> tuple[str | None, str | None]
|
|||
nones = None, None
|
||||
|
||||
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
|
||||
|
||||
soup = HTMLParser(html_data.content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue