From c48a5c20bebb0ec6a17de4e137467532b7a36f47 Mon Sep 17 00:00:00 2001 From: Firoz Ahmed Date: Mon, 9 Dec 2024 10:44:22 +0530 Subject: [PATCH] Update app.py --- app.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 09d395e..ad07b1f 100644 --- a/app.py +++ b/app.py @@ -2,20 +2,23 @@ # Load the input JSON with open('input.json', 'r') as f: - data = json.load(f) + channelsArray = json.load(f) # Create the M3U playlist content playlist = "#EXTM3U\n" -for channel in data['channels']: +for channel in channelsArray: name = channel['name'] logo = channel['tvg-logo'] group_title = channel['group-title'] - url = channel['url'] + channel_id = channel['channel-id'] + + # Reconstruct the full URL + full_url = f'https://ythls-v3.onrender.com/channel/{channel_id}.m3u8' # Add the channel to the playlist playlist += f'#EXTINF:-1 tvg-logo="{logo}" group-title="{group_title}", {name}\n' - playlist += f'{url}\n' + playlist += f'{full_url}\n' # Write the M3U playlist to a file with open('playlist.m3u', 'w') as f: