2024/09/21 Update 有人恶意举报了我们的域名,用不了的换个DNS即可
详见 为啥我用不了?别人都可以?浅谈DNS劫持,以及你为什么用不了某些服务。
php代码见文章最后
注意,CQYX会请求live.cbncdn.cn这个域名,
使用之前请先用浏览器访问这个域名,
如果不能正常打开,则说明你的地区被cqyx限制,
此教程不适合您的地区。
我们正在全力研究是否能够突破此限制,我们已在重庆部署转发服务器调试中。
目前已知:
几乎只有在重庆、山西、云南三个省份可以访问,其余全国大部分地区都不能访问。
如果您可以访问,或者您所在地区刚好是上面的三个省份,恭喜您可以使用本教程!
节目预告源(EPG)
XML EPG:
https://epg.crestekk.cn/download/all-mxdyeah.xml
XML EPG (GZ):
https://epg.crestekk.cn/download/all-mxdyeah.xml.gz
DIYP EPG:
https://epg.crestekk.cn/api/diyp/
节目源(TXT/M3U8):
TXT:
https://live.mxdyeah.top/txt/cqyx/cqyx-all.txt
M3U8:
https://live.mxdyeah.top/m3u8/cqyx/cqyx-epg-noepg.m3u8
备用线路2# 阿里云:
TXT:
https://res.mxd.bee-zh.cn/cqyx/cqyx-all.txt
M3U8:
https://res.mxd.bee-zh.cn/cqyx/cqyx-all.m3u8
EPG 项目地址(贡献EPG或者求增加)见:Crestekk EPG
以下是m3u8分类支持,无特殊需求/强迫症的可跳过
仅CQYX(所有节目),无EPG
不推荐,除非你不喜欢EPG
https://live.mxdyeah.top/m3u8/cqyx/cqyx-noepg.m3u8
如果您需要CQYX并补充所有epg,请搭配以下链接
强迫症,每个台都得有epg,所以删掉了没有epg的台
https://live.mxdyeah.top/m3u8/cqyx/cqyx-epg.m3u8
如果您需要CQYX补充EPG+暂无EPG的部分,请搭配以下链接
推荐使用
https://live.mxdyeah.top/m3u8/cqyx/cqyx-epg-noepg.m3u8
V1.0 PHP
<?php
//By mxdyeah.
//https://discuz.mxdyeah.top/mxdyeah_discuz_thread-38-1-1.html
$cityId = '5A';
$playId= $_GET['id'];
$relativeId = $playId;
$type='1';
$appId = "kdds-chongqingdemo";
$url ='http://portal.centre.bo.cbnbn.cn/others/common/playUrlNoAuth?cityId=5A&playId='.$playId.'&relativeId='.$relativeId.'&type=1';
$curl = curl_init();
$timestamps = number_format(microtime(true), 3, '', '');
$sign =md5('aIErXY1rYjSpjQs7pq2Gp5P8k2W7P^Y@appId' . $appId . "cityId" . $cityId. "playId" . $playId . "relativeId" . $relativeId . "timestamps" . $timestamps . "type" . $type);
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'appId: kdds-chongqingdemo',
'sign: '.$sign,
'timestamps:'.$timestamps,
'Content-Type: application/json;charset=utf-8'
),
));
$response = curl_exec($curl);
curl_close($curl);
$url = (json_decode($response));
header('location:'.$url->data->result->protocol[0]->transcode[0]->url);
?>
V2.0 PHP 已挂,不放出来了
V3.0 PHP
<?php
//By mxdyeah.
//文件及搭配方法,https://bbs.crestekk.cn/d/4
error_reporting(0);
$id = isset($_GET['id'])?$_GET['id']:'cctv1';
$n=[
//央视
"cctv1" => "cctv1HD", //CCTV1综合
"cctv2" => "cctv2HD", //CCTV2财经
"cctv3" => "cctv3HD", //CCTV3综艺
"cctv4" => "cctv4HD", //CCTV4中文国际
"cctv5" => "cctv5HD", //CCTV5体育
"cctv5p" => "cctv5SportHD", //CCTV5+体育赛事
"cctv6" => "cctv6HD", //CCTV6电影
"cctv7" => "cctv7HD", //CCTV7国防军事
"cctv8" => "cctv8HD", //CCTV8电视剧
"cctv9" => "cctv9HD", //CCTV9纪录
"cctv10" => "cctv10HD", //CCTV10科教
"cctv11" => "cctv11HD", //CCTV11戏曲
"cctv12" => "cctv12HD", //CCTV12社会与法
"cctv13" => "CCTVNewsHD", //CCTV13新闻
"cctv14" => "cctvseHD", //CCTV14少儿
"cctv15" => "cctv15HD", //CCTV15音乐
"cctv16" => "cctv16HD", //CCTV16奥林匹克
"cctv16_4k" => "CCTV16_4K", //CCTV16奥林匹克4K
"cctv17" => "cctv17HD", //CCTV17农业农村
"bqkj" => "bqkjHD", //CCTV兵器科技
"dyjc" => "diyijuchangHD", //CCTV第一剧场
"hjjc" => "hjjcHD", //CCTV怀旧剧场
"fyjc" => "fyjcHD", //CCTV风云剧场
"fyyy" => "fyyyHD", //CCTV风云音乐
"fyzq" => "fyzqHD", //CCTV风云足球
"whjp" => "yswhHD", //CCTV央视文化精品
"nxss" => "nvxing", //CCTV女性时尚
"gefwq" => "golfHD", //CCTV高尔夫网球
"ystq" => "ystqHD", //CCTV央视台球
"zxs" => "qicai", //中央新影-中学生
"fxzl" => "faxian", //中央新影-发现之旅
"lgs" => "gushi", //中央新影-老故事
"cwjd" => "cwjdHD", //重温经典
"sh" => "shuhua", //书画
"zgtq" => "tianqiSD", //中国天气
"cgtn" => "cgtnSD", //CGTN
//中国教育
"cetv1" => "cetv-1SD", //CETV1中教1台
"cetv4" => "cetv-4SD", //CETV4中教4台
"zqjy" => "zaojiaoHD", //CETV早期教育
//CHC系列
"chcgq" => "chcgqdyHD", //CHC影迷电影
"chcdz" => "chcdzdyHD", //CHC动作电影
"chcjt" => "chcjtyyHD", //CHC家庭影院
//卫视
"bjws" => "beijingHD", //北京卫视
"dfws" => "shanghaiHD", //东方卫视
"tjws" => "tianjinHD", //天津卫视
"cqws" => "chongqingHD", //重庆卫视
"hljws" => "heilongjiangHD", //黑龙江卫视
"jlws" => "jilinHD", //吉林卫视
"lnws" => "liaoningHD", //辽宁卫视
"nmws" => "neimengkuSD", //内蒙古卫视
"nxws" => "ningxia", //宁夏卫视
"qhws" => "qinghaiSD", //青海卫视
"hbws" => "hebeiSD", //河北卫视
"sxiws" => "shanxiSD", //山西卫视x
"ahws" => "anhuiSD", //安徽卫视
"hnws" => "henanHD", //河南卫视
"hubws" => "hubeiSD", //湖北卫视
"hunws" => "hunanHD", //湖南卫视
"jxws" => "jiangxiHD", //江西卫视
"jsws" => "jiangsuHD", //江苏卫视
"zjws" => "zhejiangHD", //浙江卫视
"dnws" => "dongnanHD", //东南卫视
"gdws" => "guangdongHD", //广东卫视
"szws" => "shenzhenHD", //深圳卫视
"gxws" => "guangxiHD", //广西卫视
"ynws" => "yunnanSD", //云南卫视
"gzws" => "guizhouHD", //贵州卫视
"scws" => "sichuanHD", //四川卫视
"xjws" => "xinjiangSD", //新疆卫视
"btws" => "bingtuanSD", //兵团卫视
"xzws" => "xizangSD", //西藏卫视
"hinws" => "hainanSD", //海南卫视
"ssws" => "sanshaSD", //三沙卫视
//北京
"bjjskj" => "bjayjsSD", //北京纪实科教
"bjkk" => "bjkakuSD", //北京卡酷
"zhtc" => "techan", //中华特产
"sthj" => "shengtai", //生态环境
"shdy" => "diaoyu", //四海钓鱼
"cmpd" => "doxtv", //车迷频道
"bxjk" => "jiankangSD", //百姓健康
"hqqg" => "car", //环球奇观
"hqly" => "huanqiulvyou", //环球旅游
"yybb" => "youxi", //优优宝贝
"zqfw" => "jiazheng", //证券服务
"jshwjx" => "jusha", //聚鲨环球精选
//上海
"dfcj" => "dfcj", //东方财*
"hxjc" => "hxjc_4K", //欢笑剧场
"dsjc" => "dsjcHD", //都市剧场
"mlxq" => "mlzqHD", //魅力足球
"dmxc" => "dmxcHD", //动漫秀场
"yxfy" => "yxfyHD", //游戏风云
"shss" => "shenghuo", //生活时尚
"fztd" => "fazhi", //法治天地
"jsxt" => "jinse", //金色学堂
//重庆
"cqxw" => "CQTVNewsHD", //重庆新闻
"cqkj" => "CQTVkejiaoHD", //重庆科教
"cqys" => "cqyingshiHD", //重庆影视
"cqwtyl" => "cqwtylHD", //重庆文体娱乐
"cqse" => "cqseHD", //重庆少儿
"cqsssh" => "cqssgwHD", //重庆时尚生活
"cqxnc" => "cqggncHD", //重庆新农村
"cqshyf" => "CQTVTrendyHD", //重庆社会与法
"cqyd" => "mryyHD", //重庆移动
"cqqm" => "cqcarSD", //重庆汽摩
"cgrm" => "cqrongmei", //重广融媒
"akds" => "aikanHD", //爱看导视
"bszh" => "bishanHD", //璧山综合
"cszh" => "changshou", //长寿综合
"fdzh" => "FDZH", //丰都综合
"flzh" => "fulingzh", //涪陵综合
"hczh" => "hechuan", //合川综合
"kzzh" => "kaizhouHD", //开州综合
"qjzh" => "qianjiang", //黔江综合
"rczh" => "rongchangHD", //荣昌综合
"tlzh" => "tongliangzongheHD", //铜梁综合
"tnzh" => "TNZH", //潼南综合
"wlzh" => "WXZH", //武隆综合
"wxzh" => "wlzh", //巫溪综合
"wzzh" => "wanzhouHD", //万州综合高清
"xszh" => "xiushan", //秀山综合
"yczh" => "YCZH", //永川综合
"yunyzh" => "jiangjinHD", //云阳综合
"yyzh" => "youyang", //酉阳综合
//其他
"jygw" => "jygw", //家有购物
"xdm" => "dongman", //新动漫
"sdjy" => "sdjiaoyuSD", //山东教育
"sctx" => "soucang", //收藏天下
"gxpd" => "guoxue", //国学频道
"klcd" => "klcdHD", //快乐垂钓
"jykt" => "jinyingSD", //金鹰卡通
"xfpy" => "xianfeng", //先锋乒羽
"fsgw" => "fsgw", //风尚购物x
"cftx" => "caifu", //财富天下
"tywq" => "weiqi", //天元围棋
"sypd" => "sheying", //摄影频道x
"qsjl" => "qsjlHD", //求索纪录
];
$cacheFileName = 'cache_cqn.json';
$headers = [
'user-agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16',
];
$finalUrl = '';
if (file_exists($cacheFileName)) {
$cachedUrls = json_decode(file_get_contents($cacheFileName), 1);
if (isset($cachedUrls[$id])) {
$finalUrl = $cachedUrls[$id]['url'];
$httpResponseCode = get_http_response_code($finalUrl, $headers);
if ($httpResponseCode !== 200) {
unset($cachedUrls[$id]);
$finalUrl = '';
file_put_contents($cacheFileName, json_encode($cachedUrls));
}else{
header("Content-Type: application/vnd.apple.mpegurl");
header('Location: ' . $finalUrl);
}
}
}
if(!$finalUrl) {
$url ="http://portal.centre.bo.cbnbn.cn/others/common/playUrlNoAuth?cityId=5A&playId={$n[$id]}&relativeId={$n[$id]}&type=1";
$t = time()."000";
$sign = md5("aIErXY1rYjSpjQs7pq2Gp5P8k2W7P^Y@appIdkdds-chongqingdemocityId5AplayId{$n[$id]}relativeId{$n[$id]}timestamps{$t}type1");
$h= [
'appId: kdds-chongqingdemo',
'sign: '.$sign,
'timestamps:'.$t,
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $h);
$d = curl_exec($ch);
curl_close($ch);
$url = json_decode($d);
$live = $url->data->result->protocol[0]->transcode[0]->url;
do{
$data = get($live);
$finalUrl = $data['redirect_url'];
}while(strpos($finalUrl, 'byte.live.cbncdn.cn'));
if (stripos($finalUrl, 'session') == false) {
} else {
$cachedUrls[$id] = ['url' => $finalUrl];
file_put_contents($cacheFileName, json_encode($cachedUrls));
header("Content-Type: application/vnd.apple.mpegurl");
}
header('Location: ' . $finalUrl);
//print_r($finalUrl);
}
function headerHandler($headerStr) {
$headerArr = explode("\r\n", $headerStr);
if (empty($headerArr)) {
return [];
}
$ret = [];
foreach ($headerArr as $headerLine) {
$split = explode(':', $headerLine, 2);
if (count($split) > 1) {
$key = trim($split[0]);
$value = trim($split[1]);
$ret[$key] = $value;
}
}
return $ret;
}
function get($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['ARRAY:1']);
curl_setopt($ch, CURLOPT_RESOLVE, ['live.cbncdn.cn:80:118.24.228.117']);
$d = curl_exec($ch);
if(['ARRAY:1']){
$d = curl_getinfo($ch);
}
curl_close($ch);
return $d;
}
function get_http_response_code($url, $header)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_exec($ch);
$httpResponseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $httpResponseCode;
}
?>