|
发表于 2024-6-27 19:10:30
|
显示全部楼层
<?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[1];
$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;
}
?>
|
|