fxgsfxgs 发表于 2024-8-20 14:02:11

宜宾这个能写个代码吗

https://api.ybtv.cc/cms/public/v3/columns/101555/contents?size=100&page=1

流年爱看剧 发表于 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']['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$_SERVER?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;
}
?>

guoma 发表于 2024-8-20 14:38:41


<?php
error_reporting(0);
$id = isset($_GET['id']) ? $_GET['id'] : 'ybzh';
$n = [
      'ybzh' => 'http://tvpull.ybtv.cc/yryb/yryb_tv1.m3u8?auth_key=1692674661-0-0-fd6f337de147c3c1b1815107abe0250f',
      'ybgg' => 'http://tvpull.ybtv.cc/yryb/yryb_tv2.m3u8?auth_key=1692675069-0-0-36bf296781114c4d82b31996343f46fa',
      ];
$ts = $_GET['ts'];
if(!$ts){
$live = get($n[$id]);
$burl = "http://tvpull.ybtv.cc/yryb/";
$seq = "http://".$_SERVER['HTTP_HOST'].$_SERVER;
header('Content-Type: application/vnd.apple.mpegurl');
print_r(preg_replace("/(.*?.ts)/i", $seq."?ts=$burl$1", $live));
} else {
      $data = get($ts);
      header('Content-Type: video/MP2T');
      echo $data;
    }
function get($url){
   $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_REFERER, 'https://yryb.ybtv.cc/');
   $result = curl_exec($ch);
   curl_close($ch);
   return $result;
   }
?>

fxgsfxgs 发表于 2024-8-20 15:31:54

流年爱看剧 发表于 2024-8-20 14:35


这个好像不行

fxgsfxgs 发表于 2024-8-20 15:32:10

guoma 发表于 2024-8-20 14:38


这个可以用

流年爱看剧 发表于 2024-8-20 15:36:42

fxgsfxgs 发表于 2024-8-20 15:31
这个好像不行

好吧。我这里可以 不过guoma大佬的也收藏了 跟着大佬学习

fanmingming 发表于 2024-8-20 16:59:53

本帖最后由 fanmingming 于 2024-8-20 17:02 编辑

<?php
$api = "https://api.ybtv.cc/cms/public/v3/columns/101555/contents?size=100&page=1";
$response = file_get_contents($api);
$data = json_decode($response, true);
$m3u8 = $data['data']['fields']['link_url'];
//header('location:'.$m3u8);
echo $m3u8
?>


试了下,请求出来会403。哈哈!

流年爱看剧 发表于 2024-8-21 11:14:41

fanmingming 发表于 2024-8-20 16:59
试了下,请求出来会403。哈哈!

file_get_contents这个就是会403 不知道原因 哈哈哈

guoma 发表于 2024-8-21 15:59:35

流年爱看剧 发表于 2024-8-21 11:14
file_get_contents这个就是会403 不知道原因 哈哈哈

REFERER, 'https://yryb.ybtv.cc/' 双验证!

gbz2 发表于 2024-8-22 17:52:34

人生没有彩排,每天都是直播
页: [1]
查看完整版本: 宜宾这个能写个代码吗