e
This commit is contained in:
parent
e49b2217c0
commit
00000d914b
2 changed files with 384 additions and 369 deletions
|
|
@ -2,23 +2,16 @@
|
|||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
from scrapers import (
|
||||
fstv,
|
||||
livetvsx,
|
||||
streambtw,
|
||||
streameast,
|
||||
streamed,
|
||||
strmd,
|
||||
tvpass,
|
||||
watchfooty,
|
||||
)
|
||||
from scrapers import fstv, streambtw, streameast, streamed, strmd, tvpass, watchfooty
|
||||
from scrapers.utils import get_logger, network
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
||||
BASE_FILE = Path(__file__).parent / "base.m3u8"
|
||||
|
||||
M3U8_FILE = Path(__file__).parent / "TV.m3u8"
|
||||
EVENTS_FILE = Path(__file__).parent / "events.m3u8"
|
||||
|
||||
COMBINED_FILE = Path(__file__).parent / "TV.m3u8"
|
||||
|
||||
|
||||
def load_base() -> tuple[list[str], int]:
|
||||
|
|
@ -36,7 +29,6 @@ async def main() -> None:
|
|||
|
||||
tasks = [
|
||||
asyncio.create_task(fstv.scrape(network.client)),
|
||||
# asyncio.create_task(livetvsx.scrape(network.client)),
|
||||
asyncio.create_task(streambtw.scrape(network.client)),
|
||||
asyncio.create_task(streameast.scrape(network.client)),
|
||||
asyncio.create_task(streamed.scrape(network.client)),
|
||||
|
|
@ -49,7 +41,6 @@ async def main() -> None:
|
|||
|
||||
additions = (
|
||||
fstv.urls
|
||||
| livetvsx.urls
|
||||
| streambtw.urls
|
||||
| streameast.urls
|
||||
| streamed.urls
|
||||
|
|
@ -58,25 +49,49 @@ async def main() -> None:
|
|||
| watchfooty.urls
|
||||
)
|
||||
|
||||
live_events = []
|
||||
live_events: list[str] = []
|
||||
|
||||
for chnl_num, (event, info) in enumerate(
|
||||
combined_channels: list[str] = []
|
||||
|
||||
for i, (event, info) in enumerate(
|
||||
sorted(additions.items()),
|
||||
start=tvg_chno + 1,
|
||||
start=1,
|
||||
):
|
||||
live_events.extend(
|
||||
(
|
||||
f'\n#EXTINF:-1 tvg-chno="{chnl_num}" tvg-id="{info["id"]}" tvg-name="{event}" tvg-logo="{info["logo"]}" group-title="Live Events",{event}',
|
||||
extinf_all = (
|
||||
f'#EXTINF:-1 tvg-chno="{tvg_chno + i}" tvg-id="{info["id"]}" '
|
||||
f'tvg-name="{event}" tvg-logo="{info["logo"]}" group-title="Live Events",{event}'
|
||||
)
|
||||
|
||||
extinf_live = (
|
||||
f'#EXTINF:-1 tvg-chno="{i}" tvg-id="{info["id"]}" '
|
||||
f'tvg-name="{event}" tvg-logo="{info["logo"]}" group-title="Live Events",{event}'
|
||||
)
|
||||
|
||||
vlc_block = [
|
||||
f'#EXTVLCOPT:http-referrer={info["base"]}',
|
||||
f'#EXTVLCOPT:http-origin={info["base"]}',
|
||||
f"#EXTVLCOPT:http-user-agent={network.UA}",
|
||||
info["url"],
|
||||
)
|
||||
]
|
||||
|
||||
combined_channels.extend(["\n" + extinf_all, *vlc_block])
|
||||
|
||||
live_events.extend(["\n" + extinf_live, *vlc_block])
|
||||
|
||||
COMBINED_FILE.write_text(
|
||||
"\n".join(base_m3u8 + combined_channels),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
M3U8_FILE.write_text("\n".join(base_m3u8 + live_events), encoding="utf-8")
|
||||
log.info(f"Base + Events saved to {COMBINED_FILE.name}")
|
||||
|
||||
log.info(f"M3U8 saved to {M3U8_FILE.name}")
|
||||
EVENTS_FILE.write_text(
|
||||
'#EXTM3U url-tvg="https://raw.githubusercontent.com/doms9/iptv/refs/heads/default/EPG/TV.xml"\n'
|
||||
+ "\n".join(live_events),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
log.info(f"Events saved to {EVENTS_FILE.name}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue