【请教+1】获取了切片的内容 还是不能播放 请大佬帮忙看看
<?php$data=file_get_contents("https://m-jiangling.cjyun.org/zhibo79");
preg_match('/https:\/\/jiangling-live21.cjyun.org\/10090\/s10090-jltv01.m3u8(.*?)"/',$data, $hbsz1);
$length = strlen($hbsz1)-1;
$hbsz2 = mb_substr($hbsz1, 0, $length, 'utf-8');
$header = array(
'Host: jiangling-live21.cjyun.org',
'Referer:https://m-jiangling.cjyun.org/',
'Origin:https://m-jiangling.cjyun.org',
'User-Agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36',
);
print_r(preg_replace("/(.*?.ts)/i", (isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"]==="on"?"http":"https")."://$_SERVER$_SERVER?ts=https://jiangling-live21.cjyun.org/10090/$1", getdata($hbsz2, $header)));
function getdata($url,$header){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
?>
必须代理ts的,因为ts也有Referer校验 本帖最后由 jiteloozz 于 2024-6-25 12:00 编辑
m3u8:https://jiangling-live21.cjyun.org/10090/s10090-jltv01.m3u8?auth_key=1735660799-0-0-13b6e4b48ae41886f872c73bd1c92400
TS:https://jiangling-live21.cjyun.o ... 2da87c15d92298139fb 使用长江云接口代理就可以了
<?php
error_reporting(0);
$ts = $_GET['ts'];
if(!$ts){
$id = isset($_GET['id']) ? $_GET['id'] : "hbjl";
$n = [
"hbjl"=>"江陵综合",
"hbws"=>"湖北卫视",
"hbjs"=>"湖北经视",
"hbzh"=>"湖北电视台",
"hbgg"=>"公共●新闻",
"hbys"=>"湖北影视",
"hbsh"=>"湖北生活",
"hbjy"=>"湖北教育",
"hbls"=>"垄上频道",
];
$url = "https://m-jiangling.cjyun.org/zhibo79";
$data = file_get_contents($url);
preg_match("/stream=(.*?)>".$n[$id]."<\/li>/i", $data,$matches);
$m3u8 = $matches;
$burl = dirname($m3u8)."/";
$php = "http://".$_SERVER ['HTTP_HOST'].$_SERVER['PHP_SELF'];
header('Content-Type: application/vnd.apple.mpegurl');
print_r(preg_replace("/(.*?.ts)/i", $php."?ts=$burl$1",m3u8(trim($m3u8))));
} else {
$data = m3u8($ts);
header('Content-Type: video/MP2T');
echo $data;
}
function m3u8($url){
$h = [
'Origin:https://m-jiangling.cjyun.org',
'Referer:https://m-jiangling.cjyun.org/',
'User-Agent: Mozilla/5.0 (Windows NT 6.1)',
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $h);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
?>
jiaerfeng 发表于 2024-6-27 19:10
大佬用不了啊
页:
[1]