把guid里面的**改成你自己电脑上央视频的cookie里面的guid,我下午的那个被封掉了用自己的应该就没事了 1246406933 发表于 2024-5-9 15:45
帮你改过能看的代码发出来看看
这种代码都不稳定得大佬维护才行还好没改加密 改的话可得慢慢等着吧 whitebird 发表于 2024-5-9 20:11
把guid里面的**改成你自己电脑上央视频的cookie里面的guid,我下午的那个被封掉了用自己的应该就没事了 ...
怎么看自己电脑上央视频的cookie里面的guid是多少? 1246406933 发表于 2024-5-10 01:53
怎么看自己电脑上央视频的cookie里面的guid是多少?
{:4_91:}这玩意不会折腾就很麻烦了,我找下原来的源码吧,应该不改动这个也能用。 1246406933 发表于 2024-5-10 01:53
怎么看自己电脑上央视频的cookie里面的guid是多少?
<?php
$id = isset($_GET['id'])?$_GET['id']:'cctv1';
$n = [
'cctv4k' => ,
'cctv8k' => ,
'cctv1' => ,
'cctv2' => ,
'cctv3' => ,//vip
'cctv4' => ,
'cctv5' => ,
'cctv5p' => ,
'cctv6' => ,//vip
'cctv7' => ,
'cctv8' => ,//vip
'cctv9' => ,
'cctv10' => ,
'cctv11' => ,
'cctv12' => ,
'cctv13' => ,
'cctv14' => ,
'cctv15' => ,
'cctv16' => ,
'cctv16-4k' => ,//vip
'cctv17' => ,
'bqkj' => ,//从这里开始
'dyjc' => ,
'hjjc' => ,
'fyjc' => ,
'fyyy' => ,
'fyzq' => ,
'dszn' => ,
'nxss' => ,
'whjp' => ,
'sjdl' => ,
'gefwq' => ,
'ystq' => ,
'wsjk' => ,//到这里结束,都是vip
'cgtn' => ,
'cgtnjl' => ,
'cgtne' => ,
'cgtnf' => ,
'cgtna' => ,
'cgtnr' => ,
'bjws' => ,
'dfws' => ,
'tjws' => ,//天津
'cqws' => ,
'hljws' => ,
'lnws' => ,
'hbws' => ,
'sdws' => ,
'ahws' => ,
'hnws' => ,
'hubws' => ,
'hunws' => ,
'jxws' => ,
'jsws' => ,
'zjws' => ,
'dnws' => ,
'gdws' => ,
'szws' => ,
'gxws' => ,
'gzws' => ,
'scws' => ,
'xjws' => ,//新疆
'hinws' => ,
];
$cnlid = $n[$id];
$livepid = $n[$id];
$rand1 = rand(101, 999);
$guid = "lsdbsu7p_tw7yti895cnrad{$rand1}";
$salt = '0f$IVHi9Qno?G';
$platform = "5910204";
$key = hex2bin("48e5918a74ae21c972b90cce8af6c8be");
$iv = hex2bin("9a7e7d23610266b1d9fbf98581384d92");
$ts = time();
$el = "|{$cnlid}|{$ts}|mg3c3b04ba|V1.0.0|{$guid}|{$platform}|https://www.yangshipin.c|mozilla/5.0 (windows nt ||Mozilla|Netscape|Win32|";
$len = strlen($el);
$xl = 0;
for($i=0;$i<$len;$i++){
$xl = ($xl << 5) - $xl + ord($el[$i]);
$xl &= $xl & 0xFFFFFFFF;
}
$xl = ($xl > 2147483648) ? $xl - 4294967296 : $xl;
$el = '|'.$xl.$el;
$ckey = "--01".strtoupper(bin2hex(openssl_encrypt($el,"AES-128-CBC",$key,1,$iv)));
function Kc($t) {//对参数数组排序并签名
$e = "";
$r = [];
$Rc = '0f$IVHi9Qno?G';
foreach ($t as $key => $value) {
$r[] = $key;
}
sort($r);
foreach ($r as $index => $key) {
if ($index != 0) {
$e .= "&";
}
if (is_array($t[$key])) {
$t[$key] = implode(",", $t[$key]);
}
$e .= $key . "=" . rawurlencode($t[$key]);
}
$e .= $Rc;
return md5($e);
}
function nu($t = 10) {
$e = "ABCDEFGHIJKlMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$r = strlen($e);
$n = "";
for ($i = 0; $i < $t; $i++) {
$n .= $e;
}
return $n;
}
$randomString = nu(10);
//获取当前毫秒级别时间
$currentTimeMillis = round(microtime(true) * 1000);
$request_id = "999999".$randomString.$currentTimeMillis;
function sign($param) {//对数据进行签名操作
$e = "";
$r = array_keys($param);
sort($r); // 排序属性名数组
foreach ($r as $n => $key) {
if ($n != 0) {
$e .= "&";
}
if (is_array($param[$key])) {
$t[$key] = implode(',', $param[$key]); // 如果属性值是数组,则转换为字符串
}
$e .= $key . "=" . rawurlencode($param[$key]); // 使用 rawurlencode 进行 URL 编码
}
$e .= "Q0uVOpuUpXTOUwRn"; // 在签名字符串末尾添加固定字符串
return md5($e); // 对签名字符串进行 MD5 哈希
}
$param = [
"pid"=>$livepid,
"guid"=>$guid,
"appid"=>"ysp_pc",
"rand_str"=>nu(10),
];
$singature=sign($param);
$param["signature"] = $singature;
//print_r($param); 查看请求数组
$bstrURL = "https://player-api.yangshipin.cn/v1/player/auth";//请求网址
$headers = [
"Content-Type: application/x-www-form-urlencoded;charset=UTF-8",
"Referer: https://www.yangshipin.cn/",
"Cookie: guid={$guid}; versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=123; updateProtocol=1; seqId=36;request-id={$request_id}",
"Yspappid: 519748109",
];
$ch = curl_init($bstrURL);
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,$headers);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($param));
$data = curl_exec($ch);
curl_close($ch);
$json_data = json_decode($data);
$token = $json_data->data->token;
//echo $token;
//auth获取结束
//开始获取get_info信息
$params = [
"cnlid" => "{$cnlid}",
"livepid" => "{$livepid}",
"stream" => "2",
"guid" => $guid,
"cKey" => $ckey,
"adjust" => 1,
"sphttps" => "1",
"platform" => "5910204",
"cmd" => "2",
"encryptVer" => "8.1",
"dtype" => "1",
"devid" => "devid",
"otype" => "ojson",
"appVer" => "V1.0.0",
"app_version" => "V1.0.0",
"rand_str" => nu(10),
"channel" => "ysp_tx",
"defn" => "fhd",
];
$sign1 = Kc($params);
$params["signature"] = $sign1;
$bstrURL1 = "https://player-api.yangshipin.cn/v1/player/get_live_info";
$headers1 = [
"Content-Type: application/json;charset=UTF-8",
"Referer: https://www.yangshipin.cn/",
"Cookie: guid={$guid}; versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=123; updateProtocol=1; seqId=36;request-id={$request_id}",
"Yspappid: 519748109",
"yspplayertoken: {$token}",
];
$ch = curl_init($bstrURL1);
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,$headers1);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($params));
$data = curl_exec($ch);
//echo $data;
// 关闭CURL会话
curl_close($ch);
$json = json_decode($data);
$live = $json->data->playurl;
$extended_param = $json->data->extended_param;
$chanllCode = json_decode($json->data->chanll)->code;
$decodeChanll = base64_decode($chanllCode);
// 定义正则表达式来匹配des_key和des_iv的赋值语句
$patternKey = '/var des_key = "(.*?)";/';
$patternIv = '/var des_iv = "(.*?)";/';
// 初始化变量用于存储提取的值
$desKey = "";
$desIv = "";
// 使用正则表达式提取des_key的值
if (preg_match($patternKey, $decodeChanll, $matchesKey)) {
$desKey = $matchesKey;
}
// 使用正则表达式提取des_iv的值
if (preg_match($patternIv, $decodeChanll, $matchesIv)) {
$desIv = $matchesIv;
}
//定义待加密数组
$jsonString = '{"mver":"1","subver":"1.2","host":"www.yangshipin.cn/#/tv/home?pid=","referer":"","canvas":"YSPANGLE(Intel,Intel(R)Iris(R)XeGraphics(0x000046A6)Direct3D11vs_5_0ps_5_0,D3D11)"}';
$data = json_decode($jsonString, true);
function encryptData($data,$desKey,$desIv) {
$plaintext = json_encode($data,JSON_UNESCAPED_SLASHES);
$key = base64_decode($desKey);
$iv = base64_decode($desIv);
$encrypted = openssl_encrypt($plaintext, 'des-ede3-cbc', $key, OPENSSL_RAW_DATA, $iv);
return strtoupper(bin2hex($encrypted));
}
//定义变量保存revoi值
$encryptedHex = encryptData($data,$desKey,$desIv);//revoi值
//header('Location:'. $live."&revoi=".$encryptedHex.$extended_param);
//exit();
$live = $live."&revoi=".$encryptedHex.$extended_param ;
$burl = explode("{$n[$id]}.m3u8",$live);
$d = file_get_contents($live);
$str = preg_replace("/(.*?.ts)/", $burl."$1",$d);
header("Content-Type: application/vnd.apple.mpegurl");
header("Content-Disposition: inline; filename=index.m3u8");
echo $str;
?> 直接替换吧,确实能用,不过VIP频道是甭想了,还有一些我没仔细查,可能ID还是错误 不过大部分应该没啥问题,折腾这玩意不如直接用现成的源,论坛那么多的 whitebird 发表于 2024-5-10 09:35
感谢分享 这个经常失效,也挺麻烦 VIP频道看不了了没啥意思了 全部挂了 等等再说吧
页:
1
[2]