乐于分享
好东西不私藏

山西省台及部分地方电视台代理源码

山西省台及部分地方电视台代理源码

山西黄河电视的代理源码。
省级频道演示如下:
山西卫视, http://tv123.tttttttttt.top/sxtv.php?id=ws黄河电视台, http://tv123.tttttttttt.top/sxtv.php?id=hh山西经济与科技, http://tv123.tttttttttt.top/sxtv.php?id=jj山西影视, http://tv123.tttttttttt.top/sxtv.php?id=ys山西社会与法治, http://tv123.tttttttttt.top/sxtv.php?id=fz山西文体生活, http://tv123.tttttttttt.top/sxtv.php?id=wt
注意,此源码包含部分地方台,但是,地方台的代理需要国内空间支持,省级台无限制,所以上面的演示可以收看,下面地方台就无法使用了,需要使用的话,请使用国内主机。
太原-1, http://tv123.tttttttttt.top/sxtv.php?id=ty朔州-1, http://tv123.tttttttttt.top/sxtv.php?id=sz忻州综合, http://tv123.tttttttttt.top/sxtv.php?id=xz阳泉新闻综合, http://tv123.tttttttttt.top/sxtv.php?id=yq大同-1, http://tv123.tttttttttt.top/sxtv.php?id=dt吕梁-1, http://tv123.tttttttttt.top/sxtv.php?id=ll晋中综合, http://tv123.tttttttttt.top/sxtv.php?id=jz长治-1, http://tv123.tttttttttt.top/sxtv.php?id=cz晋城新闻综合, http://tv123.tttttttttt.top/sxtv.php?id=jc临汾-1, http://tv123.tttttttttt.top/sxtv.php?id=lf运城-1, http://tv123.tttttttttt.top/sxtv.php?id=yc

源码如下:
<?php// 频道ID映射表$channel_map = [    // 省级频道    'ws' => ['t' => 1, 'id' => 'q8RVWgs', 'r' => 1000, 'name' => '山西卫视'],    'hh' => ['t' => 1, 'id' => 'lce1mC4', 'r' => 800, 'name' => '黄河电视台'],    'jj' => ['t' => 1, 'id' => '4j01KWX', 'r' => 800, 'name' => '山西经济与科技'],    'ys' => ['t' => 1, 'id' => 'Md571Kv', 'r' => 800, 'name' => '山西影视'],    'fz' => ['t' => 1, 'id' => 'p4y5do9', 'r' => 500, 'name' => '山西社会与法治'],    'wt' => ['t' => 1, 'id' => 'agmpyEk', 'r' => 800, 'name' => '山西文体生活'],    // 地市频道    'ty' => ['t' => 2, 'id' => '11', 'name' => '太原-1'],    'sz' => ['t' => 2, 'id' => '6', 'name' => '朔州-1'],    'xz' => ['t' => 2, 'id' => '3', 'name' => '忻州综合'],    'yq' => ['t' => 2, 'id' => '9', 'name' => '阳泉新闻综合'],'dt' => ['t' => 2, 'id' => '10', 'name' => '大同-1'],    'll' => ['t' => 2, 'id' => '1', 'name' => '吕梁-1'],    'jz' => ['t' => 2, 'id' => '5', 'name' => '晋中综合'],    'cz' => ['t' => 2, 'id' => '8', 'name' => '长治-1'],    'jc' => ['t' => 2, 'id' => '7', 'name' => '晋城新闻综合'],    'lf' => ['t' => 2, 'id' => '2', 'name' => '临汾-1'],    'yc' => ['t' => 2, 'id' => '4', 'name' => '运城-1']];// 获取当前域名$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';$domain = $_SERVER['HTTP_HOST'];$base_url = "$protocol://$domain";// 处理短IDif(isset($_GET['id']) && array_key_exists($_GET['id'], $channel_map)) {    $channel_info = $channel_map[$_GET['id']];    $t = $channel_info['t'];    $id = $channel_info['id'];    $r = isset($channel_info['r']) ? $channel_info['r'] : null;} else if (isset($_GET['t']) && isset($_GET['id'])) {    // 保留原有参数方式    $t = $_GET['t'];    $id = $_GET['id'];    $r = isset($_GET['r']) ? $_GET['r'] : null;} else {    // 显示帮助信息    echo "<h2>山西电视台频道列表</h2>";    echo "<ul>";    foreach($channel_map as $short_id => $info) {        echo "<li>{$info['name']}, $base_url/kbs/sxtv.php?id=$short_id</li>";    }    echo "</ul>";    echo "<p>使用方式: sxtv.php?id=频道ID</p>";    exit;}if($t == 1) {    $get_name = function($kt, $t = 1, $e = 'live') {        $n = $kt;        $timezone = new DateTimeZone('Asia/Shanghai');        $o = new DateTime('now', $timezone);        $dateString = $o->format('Y-m-d');        $newDate = new DateTime($dateString, $timezone);        $r = $newDate->getTimestamp() * 1000;        $a = 0;        $d = 0;        $g = -1;        $m = 0;        for($a = 0; $a < strlen($n); $a++) {            $b = ord($n[$a]);            $d += $b;            -1 != $g && ($m += $g - $b);            $g = $b;        }        $l = base_convert((string)($d += $m), 10, 36);        $s = base_convert((string)$r, 10, 36);        $p = 0;        for($a = 0; $a < strlen($s); $a++)            $p += ord($s[$a]);        $s = substr($s, 5) . substr($s, 0, 5);        $c = abs($p - $d);        $h = substr($s = strrev($l).$s, 0, 4);        $u = substr($s, 4);        $v = [];        $date = new DateTime('@' . floor($r / 1000));        $date->setTimezone($timezone);        $day = $date->format('w');        $f = $day % 2;        for($a = 0; $a < strlen($n); $a++) {            ($a % 2 == $f)                ? $v[] = $s[$a % strlen($s)]                : (            ($w = $a === 0 ? '' : $n[$a - 1])                ? (            -1 == ($x = strpos($h, $w) !== false ? strpos($h, $w) : -1)                ? $v[] = $w                : $v[] = $u[$x]            )                : $v[] = $h[$a]            );        }        return substr(strrev(base_convert((string)$c, 10, 36)) . implode('', $v), 0, strlen($n));    };    $n = $get_name($id);    $l = "https://livehhhttps.sxrtv.com/lsdream/$id/$r/$n.m3u8";} else {    $u = 'https://dyhhplus.sxrtv.com/tapi/custom/huawei_live_secret.jsp?itemId='.$id;    $c = file_get_contents($u);    $j = json_decode($c, true);    $l = $j['data']['address'];}header('Access-Control-Allow-Origin: *');header('Location: '.$l);
频道列表,可以直接不带id打开你的代理地址,类似以下:
http://tv123.tttttttttt.top/sxtv.php
本站文章均为手工撰写未经允许谢绝转载:夜雨聆风 » 山西省台及部分地方电视台代理源码

评论 抢沙发

5 + 6 =
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
×
订阅图标按钮