跳到主要内容

mytvsuper 转直链 PHP(方便 tivimate&影视等)

  • 新帖
  • 热门
  • 精选

mytvsuper 转直链 PHP(方便 tivimate&影视等)

stronghu 2y ago in IPTV · 24 views
<?php

$CHANNEL_LIST = array(
    'J' => array(
   'name' => '翡翠台',
   'license' => '0958b9c657622c465a6205eb2252b8ed:2d2fd7b1661b1e28de38268872b48480',
   'logo' => 'https://github.com/wanglindl/TVlogo/blob/main/img/TVB1.png?raw=true'
    ),
    'JUHD' => array(
   'name' => '翡翠台 4K',
   'license' => '2c045f5adb26d391cc41cd01f00416fa:fc146771a9b096fc4cb57ffe769861be',
   'logo' => 'https://github.com/wanglindl/TVlogo/blob/main/img/TVB1.png?raw=true'
    ),
    'B' => array(
   'name' => 'TVBplus',
   'license' => '56603b65fa1d7383b6ef0e73b9ae69fa:5d9d8e957d2e45d8189a56fe8665aaaa',
   'logo' => 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/TVB3.png'
    ),
    'P' => array(
   'name' => '明珠台',
   'license' => 'e04facdd91354deee318c674993b74c1:8f97a629de680af93a652c3102b65898',
   'logo' => 'https://github.com/wanglindl/TVlogo/blob/main/img/TVB1.png?raw=true'
    ),
    'CWIN' => array(
   'name' => 'Super Free',
   'license' => '0737b75ee8906c00bb7bb8f666da72a0:15f515458cdb5107452f943a111cbe89',
   'logo' => ''
    ),
    'TVG' => array(
   'name' => '黄金翡翠台',
   'license' => '8fe3db1a24969694ae3447f26473eb9f:5cce95833568b9e322f17c61387b306f',
   'logo' => 'https://github.com/sparkssssssssss/epg/blob/main/logo/%E9%BB%84%E9%87%91%E7%BF%A1%E7%BF%A0%E5%8F%B0.png?raw=true'
    ),
    'C' => array(
   'name' => '无线新闻台',
   'license' => '90a0bd01d9f6cbb39839cd9b68fc26bc:51546d1f2af0547f0e961995b60a32a1',
   'logo' => 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/TVB4.png'
    ),
    'CTVE' => array(
   'name' => '娱乐新闻台',
   'license' => '6fa0e47750b5e2fb6adf9b9a0ac431a3:a256220e6c2beaa82f4ca5fba4ec1f95',
   'logo' => 'https://github.com/sparkssssssssss/epg/blob/main/logo/%E5%A8%B1%E4%B9%90%E6%96%B0%E9%97%BB%E5%8F%B0.png?raw=true'
    ),
    'PCC' => array(
   'name' => '凤凰卫视中文台',
   'license' => '7bca0771ba9205edb5d467ce2fdf0162:eb19c7e3cea34dc90645e33f983b15ab',
   'logo' => 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/Phoenix1.png'
    ),
    'PIN' => array(
   'name' => '凤凰卫视资讯台',
   'license' => '83f7d313adfc0a5b978b9efa0421ce25:ecdc8065a46287bfb58e9f765e4eec2b',
   'logo' => 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/Phoenix2.png'
    ),
    'PHK' => array(
   'name' => '凤凰卫视香港台',
   'license' => 'cde62e1056eb3615dab7a3efd83f5eb4:b8685fbecf772e64154630829cf330a3',
   'logo' => 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/Phoenix3.png'
    ),
    'EVT1' => array(
   'name' => 'myTV SUPER直播足球1台',
   'license' => 'e8ca7903e25450d85cb32b3057948522:d5db5c03608f5f6c8a382c6abcb829e4',
   'logo' => ''
    )
);

function get_mytvsuper($channel) {
    global $CHANNEL_LIST;

    if (!array_key_exists($channel, $CHANNEL_LIST)) {
   return '频道代号错误';
    }

    $api_token = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJib3NzX2lkIjoiODUwNDY0NTgwIiwiZGV2aWNlX3Rva2VuIjoiWHp6anMzYTVKTms2TFpnZmJQeFZHR2QzIiwiZGV2aWNlX2lkIjoiTldGalptSmxNREF0TkRJNU5TMDBaakV3TFRrNFl6QXRNbUkwT0RCbFpXRTJaVEV3IiwiZGV2aWNlX3R5cGUiOiJ3ZWIiLCJkZXZpY2Vfb3MiOiJicm93c2VyIiwiZHJtX2lkIjoiTldGalptSmxNREF0TkRJNU5TMDBaakV3TFRrNFl6QXRNbUkwT0RCbFpXRTJaVEV3IiwiZXh0cmEiOnsicHJvZmlsZV9pZCI6MX0sImlhdCI6MTcwOTgwNTA3NywiZXhwIjoxNzA5ODA4Njc3fQ.XG-C6gWxLgbBRQ3ttKn68AKMQLOg6SxTpbmHxXl_qI2dbjd1eFFmwB9kD1yd2N_X8HxLPBwJukD4lygIKxbBGrQQDY_1vNd76TldllaeE2BC3fUtc-kAFOU4JwbUkfFYsWVm3v2JP-YGM2GGlhFqN_3170WDAi2Gq-R0tZckeFNWk7jOSShqkE0E7L3eqJ09sDG76R-PCbdpnCIxaY_NXtoYRfIoVQZA9QysExUyO6hQGUxLaTvJDtflX_ZM3OiqTMndHp1p0cDsINnpFokD6Yby5XS18RjQ-Dn1XJznj7-sRjlaGgyIIBoJjxsR2oD5S8teA5S6x7w3Dv6uTO3bWVV9J60E6jguGVqKnSYJ4Rx8A1TgyUTT_g57key6UFIiEhkHYqk7s3H01V-lHffNp5zDo9UrCdaO6maW_ZeA85ohR6P1PMh9EakQ5A-vok60s2oqyokKHfyrQvcodsI-MTC9mKegjJzgV2-HBgyylyj6B2ewvE4icDD25UdspWgbc33NrRpe_kgPxgVKF4cgKCD-S1AT3WrOaqKnPfPvhqmlciwlpZrUqZg09BqcazWPoyWAp2nqf93H6tlDqMrtAQgvft3Nd8-cM7jYx-WvzqRrCRpZ8vRSv11UdezKzR2Jm4H64KTWbs3GxB5vboZaeypdEzQW6PipPpftqRnNMQU'; // 请自行获取
    $headers = array(
   'Accept: application/json',
   'Authorization: Bearer ' . $api_token,
   'Accept-Language: zh-CN,zh-Hans;q=0.9',
   'Host: user-api.mytvsuper.com',
   'Origin: https://www.mytvsuper.com',
   'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.15',
   'Referer: https://www.mytvsuper.com/',
   'X-Forwarded-For: 210.6.4.148'  // 香港原生IP  210.6.4.148
    );

    $params = array(
   'platform' => 'android_tv',
   'network_code' => $channel
    );

    $url = 'https://user-api.mytvsuper.com/v1/channel/checkout?' . http_build_query($params);
    $context = stream_context_create(array('http' => array('header' => implode("\r\n", $headers))));
    $response = file_get_contents($url, false, $context);

    if ($response === false) {
   return '请求失败';
    }

    $response_json = json_decode($response, true);
    $profiles = $response_json['profiles'];

    $play_url = '';
    foreach ($profiles as $profile) {
   if ($profile['quality'] === 'high') {
  $play_url = $profile['streaming_path'];
  break;
   }
    }

    if (empty($play_url)) {
   return '未找到播放地址';
    }

    $play_url = explode('&p=', $play_url)[0];

    $license_key =$CHANNEL_LIST[    $channel]['license'];
    $channel_name =$CHANNEL_LIST[    $channel]['name'];
    $channel_logo =$CHANNEL_LIST[    $channel]['logo'];
    $m3u_content = "#EXTINF:-1 tvg-id=\"" .$channel . "\" tvg-logo=\"" .$channel_logo . "\"," .$channel_name . "\n";
    $m3u_content .= "#KODIPROP:inputstream.adaptive.manifest_type=mpd\n";
    $m3u_content .= "#KODIPROP:inputstream.adaptive.license_type=clearkey\n";
    $m3u_content .= "#KODIPROP:inputstream.adaptive.license_key=" .$license_key . "\n";
    $m3u_content .=$play_url . "\n";

    return $m3u_content;
}

// 创建或打开文件用于写入
$m3u_file = fopen('mytvfree.m3u', 'w');

// 写入 M3U 文件的头部
fwrite($m3u_file, "#EXTM3U\n");

// 遍历所有频道并写入每个频道的 M3U 内容
foreach ($CHANNEL_LIST as $channel_code => $channel_info) {
    $m3u_content = get_mytvsuper($channel_code);
    fwrite($m3u_file, $m3u_content);
}

// 关闭文件
fclose($m3u_file);

echo "所有频道的 M3U 播放列表已生成并保存为 'mytvfree.m3u'。";

?>

偷懒找群友之前分享的改的,缺的logo自己可以加加,php运行生成m3u,可用crontab -e每天定时运行更新即可,或其他方式自行修改,不懂问GPT

88 #1 2024年05月20日

沙发

回复此楼 修改
lik2004k #2 2024年05月20日

tivimate还是不能播放,什么原因

回复此楼 修改
linx #3 2024年05月21日

一次成功,感谢大佬

回复此楼 修改
qinsmoon #4 2024年05月21日

谢谢分享

回复此楼 修改
johnzdq #5 2024年05月21日

谢谢分享👍

回复此楼 修改
jinzhe #6 2024年05月21日

怎么弄的啊?

回复此楼 修改
lingch #7 2024年05月21日

还是只能在ott播,在tivimate黑屏播不了。

回复此楼 修改
cdsqbylwhf #8 2024年05月21日

谢谢分享

回复此楼 修改
eyou #9 2024年05月21日

非常感谢 让chatgpt改了一下tivimate5.04测试正常播放。

import requests
import json

CHANNEL_LIST = {
    'J': {
        'name': '翡翠台',
        'license': '0958b9c657622c465a6205eb2252b8ed:2d2fd7b1661b1e28de38268872b48480',
        'logo': 'https://github.com/wanglindl/TVlogo/blob/main/img/TVB1.png?raw=true',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=0958b9c657622c465a6205eb2252b8ed&key=2d2fd7b1661b1e28de38268872b48480'
    },
    'JUHD': {
        'name': '翡翠台 4K',
        'license': '2c045f5adb26d391cc41cd01f00416fa:fc146771a9b096fc4cb57ffe769861be',
        'logo': 'https://github.com/wanglindl/TVlogo/blob/main/img/TVB1.png?raw=true',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=2c045f5adb26d391cc41cd01f00416fa&key=fc146771a9b096fc4cb57ffe769861be'
    },
    'B': {
        'name': 'TVBplus',
        'license': '56603b65fa1d7383b6ef0e73b9ae69fa:5d9d8e957d2e45d8189a56fe8665aaaa',
        'logo': 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/TVB3.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=56603b65fa1d7383b6ef0e73b9ae69fa&key=5d9d8e957d2e45d8189a56fe8665aaaa'
    },
    'P': {
        'name': '明珠台',
        'license': 'e04facdd91354deee318c674993b74c1:8f97a629de680af93a652c3102b65898',
        'logo': 'https://github.com/wanglindl/TVlogo/blob/main/img/TVB1.png?raw=true',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=e04facdd91354deee318c674993b74c1&key=8f97a629de680af93a652c3102b65898'
    },
    'CWIN': {
        'name': 'Super Free',
        'license': '0737b75ee8906c00bb7bb8f666da72a0:15f515458cdb5107452f943a111cbe89',
        'logo': 'https://raw.githubusercontent.com/sparkssssssssss/epg/main/logo/黄金翡翠台.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=0737b75ee8906c00bb7bb8f666da72a0&key=15f515458cdb5107452f943a111cbe89'
    },
    'TVG': {
        'name': '黄金翡翠台',
        'license': '8fe3db1a24969694ae3447f26473eb9f:5cce95833568b9e322f17c61387b306f',
        'logo': 'https://github.com/sparkssssssssss/epg/blob/main/logo/%E9%BB%84%E9%87%91%E7%BF%A1%E7%BF%A0%E5%8F%B0.png?raw=true',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=8fe3db1a24969694ae3447f26473eb9f&key=5cce95833568b9e322f17c61387b306f'
    },
    'C': {
        'name': '无线新闻台',
        'license': '90a0bd01d9f6cbb39839cd9b68fc26bc:51546d1f2af0547f0e961995b60a32a1',
        'logo': 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/TVB4.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=90a0bd01d9f6cbb39839cd9b68fc26bc&key=51546d1f2af0547f0e961995b60a32a1'
    },
    'CTVE': {
        'name': '娱乐新闻台',
        'license': '6fa0e47750b5e2fb6adf9b9a0ac431a3:a256220e6c2beaa82f4ca5fba4ec1f95',
        'logo': 'https://github.com/sparkssssssssss/epg/blob/main/logo/%E5%A8%B1%E4%B9%90%E6%96%B0%E9%97%BB%E5%8F%B0.png?raw=true',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=6fa0e47750b5e2fb6adf9b9a0ac431a3&key=a256220e6c2beaa82f4ca5fba4ec1f95'
    },
    'PCC': {
        'name': '凤凰卫视中文台',
        'license': '7bca0771ba9205edb5d467ce2fdf0162:eb19c7e3cea34dc90645e33f983b15ab',
        'logo': 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/Phoenix1.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=7bca0771ba9205edb5d467ce2fdf0162&key=eb19c7e3cea34dc90645e33f983b15ab'
    },
    'PIN': {
        'name': '凤凰卫视资讯台',
        'license': '83f7d313adfc0a5b978b9efa0421ce25:ecdc8065a46287bfb58e9f765e4eec2b',
        'logo': 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/Phoenix2.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=83f7d313adfc0a5b978b9efa0421ce25&key=ecdc8065a46287bfb58e9f765e4eec2b'
    },
    'PHK': {
        'name': '凤凰卫视香港台',
        'license': 'cde62e1056eb3615dab7a3efd83f5eb4:b8685fbecf772e64154630829cf330a3',
        'logo': 'https://raw.githubusercontent.com/wanglindl/TVlogo/main/img/Phoenix3.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=cde62e1056eb3615dab7a3efd83f5eb4&key=b8685fbecf772e64154630829cf330a3'
    },
    'EVT1': {
        'name': 'myTV SUPER直播足球1台',
        'license': 'e8ca7903e25450d85cb32b3057948522:d5db5c03608f5f6c8a382c6abcb829e4',
        'logo': 'https://raw.githubusercontent.com/sparkssssssssss/epg/main/logo/黄金翡翠台.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=e8ca7903e25450d85cb32b3057948522&key=d5db5c03608f5f6c8a382c6abcb829e4'
    }
}

def get_mytvsuper(channel):
    if channel not in CHANNEL_LIST:
        return '频道代号错误'

    api_token = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJib3NzX2lkIjoiODUwNDY0NTgwIiwiZGV2aWNlX3Rva2VuIjoiWHp6anMzYTVKTms2TFpnZmJQeFZHR2QzIiwiZGV2aWNlX2lkIjoiTldGalptSmxNREF0TkRJNU5TMDBaakV3TFRrNFl6QXRNbUkwT0RCbFpXRTJaVEV3IiwiZGV2aWNlX3R5cGUiOiJ3ZWIiLCJkZXZpY2Vfb3MiOiJicm93c2VyIiwiZHJtX2lkIjoiTldGalptSmxNREF0TkRJNU5TMDBaakV3TFRrNFl6QXRNbUkwT0RCbFpXRTJaVEV3IiwiZXh0cmEiOnsicHJvZmlsZV9pZCI6MX0sImlhdCI6MTcwOTgwNTA3NywiZXhwIjoxNzA5ODA4Njc3fQ.XG-C6gWxLgbBRQ3ttKn68AKMQLOg6SxTpbmHxXl_qI2dbjd1eFFmwB9kD1yd2N_X8HxLPBwJukD4lygIKxbBGrQQDY_1vNd76TldllaeE2BC3fUtc-kAFOU4JwbUkfFYsWVm3v2JP-YGM2GGlhFqN_3170WDAi2Gq-R0tZckeFNWk7jOSShqkE0E7L3eqJ09sDG76R-PCbdpnCIxaY_NXtoYRfIoVQZA9QysExUyO6hQGUxLaTvJDtflX_ZM3OiqTMndHp1p0cDsINnpFokD6Yby5XS18RjQ-Dn1XJznj7-sRjlaGgyIIBoJjxsR2oD5S8teA5S6x7w3Dv6uTO3bWVV9J60E6jguGVqKnSYJ4Rx8A1TgyUTT_g57key6UFIiEhkHYqk7s3H01V-lHffNp5zDo9UrCdaO6maW_ZeA85ohR6P1PMh9EakQ5A-vok60s2oqyokKHfyrQvcodsI-MTC9mKegjJzgV2-HBgyylyj6B2ewvE4icDD25UdspWgbc33NrRpe_kgPxgVKF4cgKCD-S1AT3WrOaqKnPfPvhqmlciwlpZrUqZg09BqcazWPoyWAp2nqf93H6tlDqMrtAQgvft3Nd8-cM7jYx-WvzqRrCRpZ8vRSv11UdezKzR2Jm4H64KTWbs3GxB5vboZaeypdEzQW6PipPpftqRnNMQU'  # 请自行获取
    headers = {
        'Accept': 'application/json',
        'Authorization': 'Bearer ' + api_token,
        'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
        'Host': 'user-api.mytvsuper.com',
        'Origin': 'https://www.mytvsuper.com',
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.15',
        'Referer': 'https://www.mytvsuper.com/',
        'X-Forwarded-For': '210.6.4.148'  # 香港原生IP  210.6.4.148
    }

    params = {
        'platform': 'android_tv',
        'network_code': channel
    }

    url = 'https://user-api.mytvsuper.com/v1/channel/checkout'
    response = requests.get(url, headers=headers, params=params)

    if response.status_code != 200:
        return '请求失败'

    response_json = response.json()
    profiles = response_json.get('profiles', [])

    play_url = ''
    for profile in profiles:
        if profile.get('quality') == 'high':
            play_url = profile.get('streaming_path', '')
            break

    if not play_url:
        return '未找到播放地址'

    play_url = play_url.split('&p=')[0]

    license_key = CHANNEL_LIST[channel]['license_key']
    channel_name = CHANNEL_LIST[channel]['name']
    channel_logo = CHANNEL_LIST[channel]['logo']
    m3u_content = f"#EXTINF:-1 tvg-id=\"{channel}\" tvg-logo=\"{channel_logo}\",{channel_name}\n"
    m3u_content += "#KODIPROP:inputstream.adaptive.manifest_type=mpd\n"
    m3u_content += "#KODIPROP:inputstream.adaptive.license_type=clearkey\n"
    m3u_content += f"#KODIPROP:inputstream.adaptive.license_key={license_key}\n"
    m3u_content += f"{play_url}\n"

    return m3u_content

# 创建或打开文件用于写入
with open('mytvfree.m3u', 'w', encoding='utf-8') as m3u_file:
    # 写入 M3U 文件的头部
    m3u_file.write("#EXTM3U url-tvg=\"https://xmltv.bph.workers.dev\"\n")

    # 遍历所有频道并写入每个频道的 M3U 内容
    for channel_code in CHANNEL_LIST.keys():
        m3u_content = get_mytvsuper(channel_code)
        m3u_file.write(m3u_content)

print("所有频道的 M3U 播放列表已生成并保存为 'mytvfree.m3u'。")

回复此楼 修改
1 个赞
jason #10 2024年05月21日
对 lingch #7 回复

我也只是ott能看

回复此楼 修改
Guo_123 #11 2024年05月22日
对 eyou #9 回复

请问你tivi是入正了吗?我的2.1.5破解版不能放

回复此楼 修改
lj98 #12 2024年05月22日

挺好用的,谢谢分享!

回复此楼 修改
bsex #13 2024年05月22日
对 Guo_123 #11 回复

正版

回复此楼 修改
zzq12345678 #14 2024年05月22日
对 Guo_123 #11 回复

2.1.5不支持

回复此楼 修改
jefflyrop #15 2024年05月22日
对 eyou #9 回复

请问这是改的php还是workers?

回复此楼 修改
john #16 2024年05月22日

补充一下创世电视和港版CCTV1也是免费观看的

回复此楼 修改
bsex #17 2024年05月22日
对 jefflyrop #15 回复

python

回复此楼 修改
qsars #18 2024年05月23日

謝謝大神分享

回复此楼 修改
phang999 #19 2024年05月24日

用电话ott播,4k翡翠台播不了,是什么问题 其他频道正常

回复此楼 修改
phang999 #20 2024年05月24日

有这个频道全部的epg.xml吗?

回复此楼 修改
phang999 #21 2024年05月24日

会有 VIUTV和VIUTV SIX的转直链 PHP 放OTT/TIVIMATE播放的吗

回复此楼 修改
eyou #22 2024年05月24日
const CHANNEL_LIST = {
    'JUHD': {
        'name': '翡翠台超高清',
        'license': '2c045f5adb26d391cc41cd01f00416fa:fc146771a9b096fc4cb57ffe769861be',
        'logo': 'https://assets.livednow.com/logo/翡翠台.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=2c045f5adb26d391cc41cd01f00416fa&key=fc146771a9b096fc4cb57ffe769861be'
    },
    'J': {
        'name': '翡翠台',
        'license': '0958b9c657622c465a6205eb2252b8ed:2d2fd7b1661b1e28de38268872b48480',
        'logo': 'https://assets.livednow.com/logo/翡翠台.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=0958b9c657622c465a6205eb2252b8ed&key=2d2fd7b1661b1e28de38268872b48480'
    },
    'B': {
        'name': 'TVB plus',
        'license': '56603b65fa1d7383b6ef0e73b9ae69fa:5d9d8e957d2e45d8189a56fe8665aaaa',
        'logo': 'https://img.sky4k.top/TVB_Plus_CheerVisionTV.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=56603b65fa1d7383b6ef0e73b9ae69fa&key=5d9d8e957d2e45d8189a56fe8665aaaa'
    },
    'P': {
        'name': '明珠台',
        'license': 'e04facdd91354deee318c674993b74c1:8f97a629de680af93a652c3102b65898',
        'logo': 'https://assets.livednow.com/logo/明珠台.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=e04facdd91354deee318c674993b74c1&key=8f97a629de680af93a652c3102b65898'
    },
    'CWIN': {
        'name': 'Super Free',
        'license': '0737b75ee8906c00bb7bb8f666da72a0:15f515458cdb5107452f943a111cbe89',
        'logo': 'https://raw.githubusercontent.com/sparkssssssssss/epg/main/logo/黄金翡翠台.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=0737b75ee8906c00bb7bb8f666da72a0&key=15f515458cdb5107452f943a111cbe89'
    },
    'TVG': {
        'name': '黃金翡翠台',
        'license': '8fe3db1a24969694ae3447f26473eb9f:5cce95833568b9e322f17c61387b306f',
        'logo': 'https://github.com/sparkssssssssss/epg/blob/main/logo/%E9%BB%84%E9%87%91%E7%BF%A1%E7%BF%A0%E5%8F%B0.png?raw=true',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=8fe3db1a24969694ae3447f26473eb9f&key=5cce95833568b9e322f17c61387b306f'
    },
    'C': {
        'name': '無綫新聞台',
        'license': '90a0bd01d9f6cbb39839cd9b68fc26bc:51546d1f2af0547f0e961995b60a32a1',
        'logo': 'https://assets.livednow.com/logo/無線新聞台.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=90a0bd01d9f6cbb39839cd9b68fc26bc&key=51546d1f2af0547f0e961995b60a32a1'
    },
    'CTVE': {
        'name': '娛樂新聞台',
        'license': '6fa0e47750b5e2fb6adf9b9a0ac431a3:a256220e6c2beaa82f4ca5fba4ec1f95',
        'logo': 'https://github.com/sparkssssssssss/epg/blob/main/logo/%E5%A8%B1%E4%B9%90%E6%96%B0%E9%97%BB%E5%8F%B0.png?raw=true',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=6fa0e47750b5e2fb6adf9b9a0ac431a3&key=a256220e6c2beaa82f4ca5fba4ec1f95'
    },
    'PCC': {
        'name': '鳳凰衛視中文台',
        'license': '7bca0771ba9205edb5d467ce2fdf0162:eb19c7e3cea34dc90645e33f983b15ab',
        'logo': 'https://assets.livednow.com/logo/鳳凰中文.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=7bca0771ba9205edb5d467ce2fdf0162&key=eb19c7e3cea34dc90645e33f983b15ab'
    },
    'PIN': {
        'name': '鳳凰衛視資訊台',
        'license': '83f7d313adfc0a5b978b9efa0421ce25:ecdc8065a46287bfb58e9f765e4eec2b',
        'logo': 'https://assets.livednow.com/logo/鳳凰資訊.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=83f7d313adfc0a5b978b9efa0421ce25&key=ecdc8065a46287bfb58e9f765e4eec2b'
    },
    'PHK': {
        'name': '鳳凰衛視香港台',
        'license': 'cde62e1056eb3615dab7a3efd83f5eb4:b8685fbecf772e64154630829cf330a3',
        'logo': 'https://assets.livednow.com/logo/鳳凰香港.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=cde62e1056eb3615dab7a3efd83f5eb4&key=b8685fbecf772e64154630829cf330a3'
    },
    'CC1': {
        'name': '中央電視台綜合頻道 (港澳版)',
        'license': 'e50b18fee7cab76b9f2822e2ade8773a:2e2e8602b6d835ccf10ee56a9a7d91a2',
        'logo': 'https://assets.livednow.com/logo/CCTV1.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=e50b18fee7cab76b9f2822e2ade8773a&key=2e2e8602b6d835ccf10ee56a9a7d91a2'
    },
    'CRE': {
        'name': '創世電視',
        'license': 'adef00c5ba927d01642b1e6f3cedc9fb:b45d912fec43b5bbd418ea7ea1fbcb60',
        'logo': 'https://upload.wikimedia.org/wikipedia/zh/9/91/Creation-tv_logo.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=adef00c5ba927d01642b1e6f3cedc9fb&key=b45d912fec43b5bbd418ea7ea1fbcb60'
    },
     'EVT1': {
        'name': 'myTV SUPER直播足球1台',
        'license': 'e8ca7903e25450d85cb32b3057948522:d5db5c03608f5f6c8a382c6abcb829e4',
        'logo': 'https://raw.githubusercontent.com/sparkssssssssss/epg/main/logo/黄金翡翠台.png',
        'license_key': 'https://vercel-php-clearkey-hex-base64-json.vercel.app/api/results.php?keyid=e8ca7903e25450d85cb32b3057948522&key=d5db5c03608f5f6c8a382c6abcb829e4'
   }
};

const API_TOKEN = 'YOUR_API_TOKEN_HERE';

async function getMytvsuper(channel) {
    if (!CHANNEL_LIST[channel]) {
        return '频道代号错误';
    }

    const headers = {
        'Accept': 'application/json',
        'Authorization': `Bearer ${API_TOKEN}`,
        'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
        'Host': 'user-api.mytvsuper.com',
        'Origin': 'https://www.mytvsuper.com',
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.15',
        'X-Forwarded-For': '210.6.4.148'
    };

    const params = new URLSearchParams({
        'platform': 'android_tv',
        'network_code': channel
    });

    const url = `https://user-api.mytvsuper.com/v1/channel/checkout?${params.toString()}`;

    const response = await fetch(url, { headers });

    if (!response.ok) {
        return '请求失败';
    }

    const responseJson = await response.json();
    const profiles = responseJson.profiles || [];

    let playUrl = '';
    for (const profile of profiles) {
        if (profile.quality === 'high') {
            playUrl = profile.streaming_path || '';
            break;
        }
    }

    if (!playUrl) {
        return '未找到播放地址';
    }

    playUrl = playUrl.split('&p=')[0];

    const licenseKey = CHANNEL_LIST[channel].license_key;
    const channelName = CHANNEL_LIST[channel].name;
    const channelLogo = CHANNEL_LIST[channel].logo;

    let m3uContent = `#EXTINF:-1 tvg-id="${channel}" tvg-logo="${channelLogo}",${channelName}\n`;
    m3uContent += '#KODIPROP:inputstream.adaptive.manifest_type=mpd\n';
    m3uContent += '#KODIPROP:inputstream.adaptive.license_type=clearkey\n';
    m3uContent += `#KODIPROP:inputstream.adaptive.license_key=${licenseKey}\n`;
    m3uContent += `${playUrl}\n`;

    return m3uContent;
}

async function handleRequest(request) {
    let m3uFileContent = '#EXTM3U url-tvg="https://xmltv.bph.workers.dev"\n';

    for (const channelCode of Object.keys(CHANNEL_LIST)) {
        const m3uContent = await getMytvsuper(channelCode);
        m3uFileContent += m3uContent;
    }

    return new Response(m3uFileContent, {
        headers: { 'Content-Type': 'text/plain;charset=UTF-8' }
    });
}

addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request));
});

Cloudflare Workers 代码,自行替换 'YOUR_API_TOKEN_HERE'

回复此楼 修改
1 个赞
bsex #23 2024年05月25日

@coding Cloudflare Workers新部署代码值得推荐 TOKEN可以用变量方式保存保护隐私。

回复此楼 修改
24 楼 已删除
coding #25 2024年05月25日
对 bsex #23 回复

有道理,这是个简单的 demo,我后面会集成到 pixman docker 镜像上

回复此楼 修改
JIMKUN #26 2024年05月26日
对 eyou #22 回复

昨天一天都是正常的,今天显示403拒绝访问了,怎么办哦

回复此楼 修改
bsex #27 2024年05月26日
对 JIMKUN #26 回复

我试了下前几天部署的Workers,正常。

回复此楼 修改
bsex #28 2024年05月26日
对 JIMKUN #26 回复

TiviMate源那里设置为每次启动时更新没有?

回复此楼 修改
JIMKUN #29 2024年05月26日
对 bsex #28 回复

原来如此谢谢了,用的试用版没有自动更新功能。

回复此楼 修改
30 楼 已删除
  • 1
  • 2
  • 下一页
收到新回复,点击立即加载
需要 登录 后方可回复, 如果你还没有账号请 注册新账号
@stronghu
统计信息
会员
1,799
话题
260
回帖
2,984
活跃会员 查看排行
stronghu
Brian9394
mengzehe
coding
fandaz
Raymon
duboy
v6wind
jefflyrop
daisy_rain
john
jerainlvjing
rudy
tiao
jiangwl
server
winship
xiasufern
ccf
tvbjack

A digital lifestyle community co-maintained by Pixer

本网站服务器由 提供,CDN 由 提供,基于 Homeland 构建,采用 Docker 部署。