本帖最后由 大理段誉 于 2023-8-14 08:11 编辑
很多学院的视频都是同源的,详见guoma大侠的帖子,今天无事,把以前的代码修改了下,免费分享给大家。
还是老规矩,回复可见:
<?php
error_reporting(0);
$id = isset($_GET['id'])?$_GET['id']:'';
if($id==''){
$html = get_text('https://iptv.luas.edu.cn/vod-show?tags=0_4&page=1');
$html .= get_text('https://iptv.luas.edu.cn/vod-show?tags=0_4&page=2');
$html .= get_text('https://iptv.luas.edu.cn/vod-show?tags=0_6&page=1');
$html .= get_text('https://iptv.luas.edu.cn/vod-show?tags=0_6&page=2');
$html .= get_text('https://iptv.luas.edu.cn/vod-show?tags=0_6&page=3');
preg_match_all('/"\/cover\/tv\/(\d+)\.jpg" alt="([^"]+)"/', $html, $f);
$titles = [];
for ($i = 0; $i < count($f[0]); $i++) {
$id = $f[1][$i];
$title = $f[2][$i];
$titles[$id] = $title;
}
foreach ($titles as $id => $title) {
echo $title . ", " . get_http_type().$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?id='.$id . "<br>";
}
}else{
$d = get_text("https://iptv.luas.edu.cn/tv-show-detail/".$id);
preg_match('/var play_url = "(.*?)"/',$d,$p);
$path=["http://video.lzjtu.edu.cn","https://iptv.luas.edu.cn","http://tv.xxvtc.edu.cn"];
$path1=$path[mt_rand(0,count($path)-1)];
$playurl = str_replace("//iptv.luas.edu.cn",$path1,$p[1]);
header("Content-Type: application/vnd.apple.mpegurl");
header ('location:'.$playurl);
}
function get_http_type()
{
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
return $http_type;
}
function get_text($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$curl_code=curl_exec($ch);
return $curl_code;
}
?>
发帖注意事项
请勿胡乱发帖:https://www.right.com.cn/forum/thread-8307840-1-1.html
账户手机验证:https://www.right.com.cn/forum/home.php?mod=spacecp&ac=plugin&id=jzsjiale_sms:home
|