Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
firofame authored Dec 9, 2024
1 parent db5bdb2 commit c48a5c2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c48a5c2

Please sign in to comment.