This commit is contained in:
doms9 2025-09-02 18:06:35 -04:00
parent 7617aa4bc6
commit 00000d941c
6 changed files with 243 additions and 159 deletions

View file

@ -7,11 +7,11 @@ from scrape import ace, fstv, livetvsx, logger, tvpass
log = logger.get_logger(__name__)
base_url = "https://s.id/ePwXT"
BASE_URL = "https://s.id/ePwXT"
m3u8_file = Path(__file__).parent / "TV.m3u8"
M3U8_FILE = Path(__file__).parent / "TV.m3u8"
client = httpx.AsyncClient(
CLIENT = httpx.AsyncClient(
timeout=5,
follow_redirects=True,
headers={
@ -24,10 +24,10 @@ async def vanilla_fetch() -> tuple[list[str], int]:
log.info("Fetching base M3U8")
try:
r = await client.get(base_url)
r = await CLIENT.get(BASE_URL)
r.raise_for_status()
except Exception as e:
log.error(f'Failed to fetch "{base_url}"\n{e}')
log.error(f'Failed to fetch "{BASE_URL}"\n{e}')
raise SystemExit(e) from e
d = r.text.splitlines()[1:]
@ -41,8 +41,8 @@ async def main() -> None:
tasks = [
# ace.main(client),
# fstv.main(client),
livetvsx.main(),
tvpass.main(client),
livetvsx.main(CLIENT),
tvpass.main(CLIENT),
]
await asyncio.gather(*tasks)
@ -59,7 +59,7 @@ async def main() -> None:
)
]
m3u8_file.write_text(
M3U8_FILE.write_text(
'#EXTM3U url-tvg="https://raw.githubusercontent.com/doms9/iptv/refs/heads/default/EPG/TV.xml"\n'
+ "\n".join(base_m3u8)
+ "\n"
@ -68,7 +68,7 @@ async def main() -> None:
encoding="utf-8",
)
log.info(f"M3U8 saved to {m3u8_file.name}")
log.info(f"M3U8 saved to {M3U8_FILE.name}")
if __name__ == "__main__":