|
|
发表于 2025-11-19 20:23:42
|
显示全部楼层
|
<?php error_reporting(0); header('Access-Control-Allow-Origin: *'); $id = intval($_GET['id'] ?? 0); if(empty($id)) die('ID参数不能为空'); $context = stream_context_create([ 'http' => [ 'timeout' => 10, 'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', 'header' => "Referer: https://www.sitv.com.cn/\r\n" ], 'ssl' => ['verify_peer' => false, 'verify_peer_name' => false] ]); $urls = [ 'https://www.sitv.com.cn/sitv/episodeList/'.$id, 'https://www.sitv.com.cn/sitv/play/video/'.$id ]; $playAuth = ''; foreach($urls as $u) { $c = @file_get_contents($u, false, $context); if($c && preg_match("/playAuth\s*=\s*'([^']+)'/", $c, $m)) { $playAuth = str_replace('&', '&', $m[1]); break; } } if(empty($playAuth)) die('未找到playAuth参数'); // 转换为1300/flow.m3u8格式 $new_url = preg_replace('/\/prime\.m3u8\?.*$/', '/1300/flow.m3u8?bit=1300', $playAuth); if($new_url === $playAuth) { $pos = strpos($playAuth, 'prime.m3u8'); if($pos !== false) { $new_url = substr($playAuth, 0, $pos) . '1300/flow.m3u8?bit=1300'; } } header('Location: '.$new_url); ?> |
|