找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 1475|回复: 8

[iptv信源 资源分享或寻求] PHP获取CBA赛事ID一例2.2版

[复制链接]
发表于 2022-12-12 17:43 | 显示全部楼层 |阅读模式
本帖最后由 jiteloozz 于 2022-12-15 20:32 编辑

重写了两处代码,看起来更舒服了。

有兴趣的可以对比一下已发表的1.2版。若有不足之处,欢迎指正~~~

其实可以获取整个赛事的ID的。。。
  1. <?php
  2. header('Content-Type: text/json;charset=UTF-8');
  3. $url = 'https://v1-sc.miguvideo.com/vms-match/v6/staticcache/basic/match-list/normal-match-list/0/2221401/default/1/miguvideo';
  4. $data = json_decode(get_data($url));   
  5. $nowdays = date('Ymd');
  6. $days =$data->body->days;
  7. $num=array_keys($days,$nowdays)[0];
  8. $prevdays=$days[$num-1];
  9. foreach ($data->body->matchList->$nowdays as $match){
  10.   if($match->matchStatus==1){   //直播
  11.     $pids[]=$match->pID;
  12.   }
  13.   if($match->matchStatus==2){   //回放
  14.     $mids[]=$match->mgdbId;
  15.     $rids[]=$match->pID;     
  16.   }
  17. }
  18. $ids=!empty($pids)?$pids:$mids;
  19. if(empty($ids)){
  20.   foreach ($data->body->matchList->$prevdays as $match){
  21.     if($match->matchStatus==2){
  22.       $mids[]=$match->mgdbId;
  23.       $rids[]=$match->pID;
  24.     }
  25.   }
  26.   $ids=$mids;
  27. }
  28. $playtype =isset($_GET['type'])&&!empty($ids[$_GET['type']])?$_GET['type']:array_rand($ids,1);
  29. $id=$ids[$playtype];
  30. if(!empty($rids)){
  31.   $rid=$rids[$playtype];
  32. }
  33. if(strlen($id)>9){
  34.   $bsurl='https://app-sc.miguvideo.com/vms-match/v5/staticcache/basic/all-view-list/'.$id.'/2/miguvideo';
  35.   $info = json_decode(get_data($bsurl));
  36.   foreach ($info->body->replayList as $pre){
  37.     if(strpos($pre->name,'回放')!==false&&$pre->tip==null){
  38.       $eids[]=$pre->pID;
  39.     }
  40.   }
  41.   $id=!empty($eids)?$eids[array_rand($eids,1)]:$rid;
  42. }

  43. echo $id;

  44. function get_data($url){
  45.   $headers = array(
  46.     'appid:miguvideo',
  47.     'terminalid: WWW',
  48.     'Accept-Encoding: gzip, deflate',
  49.     'Referer: https://www.miguvideo.com/mgs/website/prd/',  
  50.     );
  51.   $ch = curl_init();
  52.   curl_setopt($ch, CURLOPT_URL, $url);
  53.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  54.   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  55.   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  56.   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  57.   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  58.   curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
  59.   $data = curl_exec($ch);
  60.   curl_close($ch);
  61.   return $data;
  62. }
复制代码

更新2.1版,修复第35句获取不到数据的问题,加了个头 'appid: miguvideo','terminalid: WWW'
更新2.2版,修改第37句foreach ($info->body->replayList as $pre){,剔除需要用劵观看的ID。

说明:
这个php只是获取ID而已......



我的恩山、我的无线 The best wifi forum is right here.
发表于 2022-12-12 18:23 | 显示全部楼层
本帖最后由 Habibi10000 于 2022-12-12 18:25 编辑

我一直打不开,在浏览器中http://192.168.10.100:400/cba.php?type=0 返回:754841456,明白了,获取的是一个ID,我添加进去试试
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-12-13 07:41 | 显示全部楼层
研究一下,辛苦了!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-12-13 08:34 | 显示全部楼层
谢谢分享!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-12-13 11:59 | 显示全部楼层
最近怎么都玩某咕?有什么新出的好东西?我应该庆幸我已经爬完了某咕xx的尾巴?

点评

向大佬学习~~~自己瞎琢磨而已  详情 回复 发表于 2022-12-13 14:35
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-12-13 14:35 | 显示全部楼层
wjxgzz 发表于 2022-12-13 11:59
最近怎么都玩某咕?有什么新出的好东西?我应该庆幸我已经爬完了某咕xx的尾巴?

向大佬学习~~~自己瞎琢磨而已
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-12-14 22:45 | 显示全部楼层
请问有足球的吗?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-4-24 11:29 来自手机 | 显示全部楼层
这个php是直接用的?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-4-25 09:23 | 显示全部楼层
多谢了,收下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-26 08:04

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表