|
发表于 2025-9-3 20:27:32
|
显示全部楼层
<?php
//https://zasjt.zatvs.cn/videolive-info/qftvqpbsedessquowaadwpexqupxuwrd/88a43d204fc20e36bdd8c76f88bd6462/cad887a9e2ad4652a1a29290ff559862
$u = 'https://api.zatvs.cn/jkplatform/v1/common/time';
$time = (new DateTime("now", new DateTimeZone("Asia/Shanghai")))->format("Y-m-d H:i:s");
$c = send_request($u, false, $time, false, null, $cookie);
$j = json_decode($c);
$time = $j->results->body->time;
$u = 'https://api.zatvs.cn/jkplatform/v1/mediaPlayer/getPlayerUrl';
$c = send_request($u, true, $time, true, $cookie);
$j = json_decode($c);
$b = $j->results->body;
$l = !empty($b->HDUrl) ? $b->HDUrl : $b->SDUrl;
header('Access-Control-Allow-Origin: *');
header('Location: '.$l);
function send_request($url, $is_post, $time, $need_program_params, $request_cookie = null, &$response_cookie = null) {
$appid = 'qftvqpbsedessquowaadwpexqupxuwrd';
$udid = '084361737F000001496D562F0349FC79';
$timestamp = str_replace(['-', ' ', ':'], '', $time);
$d = array(
'appid' => $appid,
'v' => '1.0.0.0',
'os' => 'android',
'terminal' => '2',
'channel' => '',
'udid' => $udid,
'timestamp' => $timestamp,
'token' => '',
'sign' => md5("sign".$appid.$udid."".$timestamp."sign"),
'page' => '',
'step' => '',
);
if ($need_program_params) {
$programId = 'cad887a9e2ad4652a1a29290ff559862';
$d['programId'] = $programId;
$d['programType'] = 'liveVideo';
}
$p = http_build_query($d);
$h = [];
if ($is_post) {
$h = [
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
'content' => $p,
];
} else
$url .= '?'.$p;
if ($request_cookie !== null) {
$h['header'] .= "Cookie: $request_cookie\r\n";
}
$h['header'] .= "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36\r\n"
."Referer: https://zasjt.zatvs.cn/\r\n";
$r = file_get_contents($url, false, stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
),
'http' => $h,
)));
// if ($r === false) {
// $error = error_get_last(); // 获取最后一次错误
// echo "请求失败!错误信息:" . $error['message'];
// } else {
//// echo "请求成功,内容长度:" . strlen($content);
// }
if (func_num_args() > 5) {
$cookies = [];
foreach ($http_response_header as $h)
if (preg_match('/Set-Cookie:\s*(.*?);/i', $h, $m) === 1)
$cookies[] = $m[1];
$response_cookie = implode('; ', $cookies);
}
return $r;
} |
|