File size: 1,752 Bytes
efd9131
29a8fbb
 
efd9131
 
29a8fbb
efd9131
 
 
 
 
 
 
 
 
29a8fbb
efd9131
 
 
 
 
 
29a8fbb
efd9131
 
 
 
 
 
29a8fbb
efd9131
 
 
 
 
 
 
29a8fbb
efd9131
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import streamlit as st
import requests

def main():
    st.title("JioCinema M3U8 Generator")

    # Fetch data from the JSON link
    data_url = "https://popoproxy.yuyutsu.workers.dev"
    try:
        response = requests.get(data_url)
        response.raise_for_status()  # Raise an exception for bad status codes
        data = response.json()
    except requests.exceptions.RequestException as e:
        st.error(f"Error fetching data: {e}")
        return

    # Find the relevant API data
    jiocinema_data = None
    for api_data in data:
        if api_data.get("Api_name") == "RJIL_JioCinema":
            jiocinema_data = api_data
            break

    if jiocinema_data:
        # Generate M3U content
        m3u_content = "#EXTM3U\n"
        for channel in jiocinema_data["channels"]:
            m3u_content += f'#EXTINF:-1 tvg-id="{channel["channel_id"]}" tvg-logo="{channel["logo"]}" group-title="{channel["category"]}", {channel["name"]}\n'
            m3u_content += f'{channel["link"]}\n'

        # Display other details
        st.write("**API Details:**")
        st.write(f"API Name: {jiocinema_data['Api_name']}")
        st.write(f"Total Channels: {jiocinema_data['total_channels']}")
        st.write(f"Developer: {jiocinema_data['developer']}")
        st.write(f"Last Update: {jiocinema_data['last_update']}")
        st.write(f"Cookie Expire: {jiocinema_data['cookie_expire']}")

        # Download button for M3U file
        st.download_button(
            label="Download JioCinema.m3u",
            data=m3u_content,
            file_name="JioCinema.m3u",
            mime="audio/x-mpegurl",
        )
    else:
        st.error("JioCinema data not found in the JSON response.")

if __name__ == "__main__":
    main()