恩山无线论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
 迅雷TV版在当贝应用市场独家首发恩山
查看: 545|回复: 3

[iptv信源 资源分享或寻求] 求个kangbatv.php

[复制链接]
发表于 2022-6-6 01:11 | 显示全部楼层 |阅读模式
10恩山币
之前我发帖子求过一个,不过输出的是这种内容。

现在求大佬修复一下。川台经常变更ID,时不时的失效,康巴tv有单独的app,也有官网,用的接口都是同一个厚健的。有推送过一段时间的1080p,目前已经变更为720p。





  1. #EXTM3U
  2. #EXT-X-VERSION:3
  3. #EXT-X-MEDIA-SEQUENCE:772873
  4. #EXT-X-TARGETDURATION:6
  5. #EXTINF:5.899,
  6. kb.php?ts=/1_sd/1654447460/1654448659891.ts?auth_key=1654455859-0-0-a09980be2c8beb00ed71fb14533bd8b1
  7. #EXTINF:5.912,
  8. kb.php?ts=/1_sd/1654447460/1654448665771.ts?auth_key=1654455865-0-0-46d23e4cd6750ee29355eccc9107dc83
  9. #EXTINF:5.904,
  10. kb.php?ts=/1_sd/1654447460/1654448671643.ts?auth_key=1654455871-0-0-8f46093507222824a62453d8201b9805
  11. #EXTINF:5.917,
  12. kb.php?ts=/1_sd/1654447460/1654448677534.ts?auth_key=1654455877-0-0-1b3678c055f74697c084d0a63c67f459
  13. #EXTINF:5.909,
  14. kb.php?ts=/1_sd/1654447460/1654448683412.ts?auth_key=1654455883-0-0-6c1376a6ae74284318aba123a3c09aec
复制代码
  1. <pre style="color: rgb(0, 0, 0); white-space: pre-wrap;">
  2. </pre><pre><font color="#000000"><span style="white-space: pre-wrap;"><?php
  3. error_reporting(0);
  4. header('Content-Type: text/json;charset=UTF-8');
  5. $ref = "http://www.kangbatv.com/zb_22587/";
  6. $data = json_decode(file_get_contents("https://mapi.kangbatv.com/api/v1/channel_detail.php?channel_id=17"));
  7. $data = $data[0]->channel_stream;
  8. $playurl = $data[0]->m3u8;
  9. $ts = $_GET['ts'];

  10. if($ts == NULL){
  11. $data = str_replace('../..','kb.php?ts=',getdata($playurl,"1",$ref));
  12. print_r($data);
  13. }else{
  14. print_r(getdata("http://pluslive.kangbatv.com/".$ts,"0",$ref));
  15. }

  16. function getdata($url,$type,$ref){
  17. $header = array(
  18. "Referer: ".$ref,
  19. "Connection: Keep-Alive",
  20. );
  21. $ch = curl_init();
  22. curl_setopt($ch, CURLOPT_URL, $url);
  23. curl_setopt($ch, CURLOPT_RETURNTRANSFER, $type);
  24. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  25. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  26. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  27. $data = curl_exec($ch);
  28. curl_close($ch);
  29. return $data;
  30. }
  31. ?></span></font></pre>
复制代码



我的恩山、我的无线 The best wifi forum is right here.
发表于 2022-6-6 05:54 | 显示全部楼层
好像TS不用Referer了。。。
  1. <?php
  2. error_reporting(0);
  3. header('Content-Type: text/json;charset=UTF-8');
  4. $data = json_decode(get_data("https://mapi.kangbatv.com/api/v1/channel_detail.php?channel_id=17"));
  5. $playurl = $data[0]->channel_stream[0]->m3u8;
  6. print_r(str_replace('../..','http://pluslive.kangbatv.com',get_data($playurl)));

  7. function get_data($url){
  8. $header = array(
  9. "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64) AppleWebKit/536.26 (KHTML, like Gecko)  Chrome/86.0.3282.186 Safari/537.36 ",   
  10. "Referer: http://www.kangbatv.com/zb_22587/",
  11. );
  12. $ch = curl_init();
  13. curl_setopt($ch, CURLOPT_URL, $url);
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  16. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  17. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  18. $data = curl_exec($ch);
  19. curl_close($ch);
  20. return $data;
  21. }
  22. ?>
复制代码


我的恩山、我的无线 The best wifi forum is right here.
发表于 2022-6-6 19:21 | 显示全部楼层
$playurl = $data[0]->m3u8;
直接:header('Location:'.$playurl);
不用切片。
我的恩山、我的无线 The best wifi forum is right here.
发表于 2022-6-7 15:09 | 显示全部楼层
以上二位都是大神。。赞
我的恩山、我的无线 The best wifi forum is right here.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )|网站地图

GMT+8, 2022-10-6 05:35

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

| 江苏省互联网有害信息举报中心 举报信箱:js12377@jschina.com.cn 举报电话:025-88802724 | 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797
快速回复 返回顶部 返回列表