This commit is contained in:
doms9 2025-08-31 08:29:01 -04:00
parent a917d4548d
commit 00000d9fce
3 changed files with 16 additions and 18 deletions

View file

@ -3,7 +3,7 @@ import asyncio
from pathlib import Path from pathlib import Path
import httpx import httpx
from scrape import fstv, logger, tvpass from scrape import logger, tvpass # , fstv
log = logger.get_logger(__name__) log = logger.get_logger(__name__)
@ -32,25 +32,25 @@ async def vanilla_fetch() -> tuple[list[str], int]:
d = r.text.splitlines()[1:] d = r.text.splitlines()[1:]
last_chnl_number = int(r.text.split("tvg-chno=")[-1].split('"')[1]) last_chnl_num = int(r.text.split("tvg-chno=")[-1].split('"')[1])
return d, last_chnl_number return d, last_chnl_num
async def main() -> None: async def main() -> None:
await tvpass.main(client) await tvpass.main(client)
await fstv.main(client) # await fstv.main(client)
base_m3u8, chnl_number = await vanilla_fetch() base_m3u8, tvg_chno = await vanilla_fetch()
additions = tvpass.urls | fstv.urls additions = tvpass.urls # | fstv.urls
lines = [ lines = [
f'#EXTINF:-1 tvg-chno="{chnl_number}" tvg-id="(N/A)" tvg-name="{event}" tvg-logo="{info["logo"]}" group-title="Live Events",{event}\n{info["url"]}' f'#EXTINF:-1 tvg-chno="{chnl_num}" tvg-id="(N/A)" tvg-name="{event}" tvg-logo="{info["logo"]}" group-title="Live Events",{event}\n{info["url"]}'
for chnl_number, (event, info) in enumerate( for chnl_num, (event, info) in enumerate(
sorted(additions.items()), sorted(additions.items()),
start=chnl_number + 1, start=tvg_chno + 1,
) )
] ]

View file

@ -1,7 +1,5 @@
import logging import logging
reset = "\033[0m"
log_format = "[%(asctime)s] %(levelname)-8s %(message)-70s %(filename)s:%(lineno)d" log_format = "[%(asctime)s] %(levelname)-8s %(message)-70s %(filename)s:%(lineno)d"
colors = { colors = {
@ -10,13 +8,15 @@ colors = {
"WARNING": "\033[33m", "WARNING": "\033[33m",
"ERROR": "\033[31m", "ERROR": "\033[31m",
"CRITICAL": "\033[41m", "CRITICAL": "\033[41m",
"reset": "\033[0m",
} }
class ColorFormatter(logging.Formatter): class ColorFormatter(logging.Formatter):
def format(self, record) -> str: def format(self, record) -> str:
color = colors.get(record.levelname, "") color = colors.get(record.levelname, "")
record.levelname = f"{color}{record.levelname}{reset}"
record.levelname = f"{color}{record.levelname}{colors['reset']}"
return super().format(record) return super().format(record)

View file

@ -75,15 +75,13 @@ async def main(client: httpx.AsyncClient) -> None:
if tvg_name: if tvg_name:
tvg_name = "(".join(tvg_name.split("(")[:-1]).strip() tvg_name = "(".join(tvg_name.split("(")[:-1]).strip()
logo = logos.get(
sport,
"https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
)
if url.endswith("/hd"): if url.endswith("/hd"):
urls[f"[{sport}] {tvg_name}"] = { urls[f"[{sport}] {tvg_name}"] = {
"logo": logo,
"url": f"http://origin.thetvapp.to/hls/{url.split('/')[-2]}/mono.m3u8", "url": f"http://origin.thetvapp.to/hls/{url.split('/')[-2]}/mono.m3u8",
"logo": logos.get(
sport,
"https://i.gyazo.com/ec27417a9644ae517196494afa72d2b9.png",
),
} }
if urls: if urls: