|
发表于 2024-8-20 14:35:04
|
显示全部楼层
- <?php
- error_reporting(0);
- header('Content-Type: text/qt;charset=UTF-8');
- $header = array(
- 'Referer: https://www.ybtv.cc/',
- 'X-User-Agent:nmip-ios-app',
- 'Cookie:SID=R38R7Dtyaz2JVv7GQk9XKDU9iQpF9eC69N8MZxLaT0lTGGviadV7gQ==',
- 'Client: iPhone16,1;iOS;17.3.1'
- );
- $ts = $_GET['ts'];
- if(!$ts){
- $url = "https://api.ybtv.cc/cms/public/v3/columns/101555/contents?size=100&page=1";
- $curl = curl_init();
- curl_setopt_array($curl, array(
- CURLOPT_URL => $url,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => '',
- CURLOPT_MAXREDIRS => 10,
- CURLOPT_TIMEOUT => 0,
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
- CURLOPT_CUSTOMREQUEST => 'GET',
- ));
- $response = json_decode(curl_exec($curl),true);
- curl_close($curl);
- $playurl = $response['data'][0]['fields']['link_url'];
- $data = getdata($playurl, $header);
- $burl = dirname($playurl)."/";
- print_r(preg_replace("/(.*?.ts)/i", (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]==="on"?"https":"http")."://$_SERVER[HTTP_HOST]$_SERVER[PHP_SELF]?ts=$burl$1", $data));
- }else {
- header('Content-Type: video/MP2T');
- header("Content-Disposition: attachment; filename=index.ts");
- print_r(getdata($ts,$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;
- }
- ?>
复制代码 |
|