获取所有频道信息:http://zsnc.nctv.net.cn/api/contents/list?category_id=469&page_size=20&page=1
源码
算法有点复杂。
<?php error_reporting(0); $_id = $_GET['id']; // 1 2 3 4 //http://zsnc.nctv.net.cn/api/contents/list?category_id=469&page_size=20&page=1 获取所有频道信息 //http://zsnc.nctv.net.cn/api/contents/info?id=126786 $channel_id = array('jw22cAZ','LfqghkO','an6J0sz','22zqwYf'); // 126784 126785 126786 126787 $_id = $channel_id [intval($_id)-1]; $md52 = md5($_id.'Tidenctvzsncapp'); $str3 = time(); $sb = ''; $sb = $sb.substr($md52,0,2); $sb = $sb.substr($md52,4,4); $sb = $sb.substr($md52,14,1); $sb = $sb.substr($md52,13,1); $sb = $sb.substr($md52,12,1); $sb = $sb.substr($md52,25,4); $sb = $sb.substr($md52,30,1); $sb = $sb.substr($md52,29,1); $sb = $sb.substr($md52,28,1); $sb = $sb.substr($md52,27,1); $sb = $sb.substr($md52,26,1); $md53 = md5('tide'.$str3.$sb); $replace = 't='.$str3.'&c='.$_id.'&a=nctvzsncapp'.'&v='.substr($md53,4,1).substr($md53,16,1).substr($md53,31,1).substr($md53,17,1).substr($md53,8,1); $replace = base64_encode($replace); $replace = str_replace('=','|',$replace); preg_match_all('/[1-9]/',$replace,$trim); $trim = array_unique($trim[0]); //滤重 $str4 = $replace; ////// 我特别想把写这段代码的,拉出来鞭尸 ////// for($i=0;$i<count($trim);$i++) { $intval = intval($trim[$i]); if($intval % 2 == 0) { $string2 = substr($replace,$intval-1,1); if(stripos('abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ',$string2)>=0) { $indexOf = (strpos('abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ',$string2) + ($intval * $intval)) % 52; $str4 = replaceSomeWhere($str4, substr('abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ',$indexOf,1),$intval); } } else { $string3 = substr($replace,$intval-1,1); if(stripos('abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ',$string3)>=0) { $indexOf2 = (strpos('abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ',$string3) + $intval ) % 52; $str4 = replaceSomeWhere($str4 , substr('abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ',$indexOf2,1),$intval); } } } $bstrURL = 'http://mediaapi.nctv.net.cn/apiv3.2.3/m3u8.php?token='.$str4; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $bstrURL); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Dalvik/2.1.0 (Linux; U; Android 6.0; 1505-A01 Build/MRA58K)"); $data = curl_exec($ch); curl_close($ch); $data = substr($data,3,strlen($data)-2); // 妈的。这个地方恶心到我了。无敌!!! $obj = json_decode($data); if($obj->status == 1) { header('location:'.$obj->address); } else { header("Refresh:0"); // 因为有个特别恶心的点,可能会出现token过期,所以让它刷新再获取。 } function replaceSomeWhere($str,$str2,$i) // What the fuck! { $str3 = ''; $str4 = ''; if ($i !=1) { $str4 = substr($str,0,$i-1); $str3 = substr($str,$i); } else { $str4 = ''; $str3 = substr($str,$i); } return $str4.$str2.$str3 ; } ?>
测试地址:
http://stream.guihet.com/t/nctvzs.php?id=1
新闻综合频道,id=1
都市频道,id=2
资讯频道,id=3
公共频道,id=4
2021-04-19 原APP已经改版,源码仅供学习。