10086 发表于 2025-3-28 21:18:58

请求guoma大佬更新北京台代码

北京时间最近上新了4K卫视频道,但将ID添加进源代码中无法成功获取URL(不清楚是不是没抓对ID) 5755n511tbk8flo40l4c71l0sdf

guoma 发表于 2025-3-28 21:43:07

10086 发表于 2025-3-28 21:52:20

guoma 发表于 2025-3-28 21:43
**** 该帖被屏蔽 ****

怎么被屏蔽了(傻眼)

guoma 发表于 2025-3-28 22:09:37

bjws4k无需解密。在$stream_url = json_decode($d,1)['data']['video_stream']['stream_url'];后加个判断句:
if($id=='bjws4k'){
   $playurl = $stream_url;
   } else {
   $playurl = base64_decode(base64_decode(strrev($stream_url)));
   }

jasonshu2025 发表于 2025-3-28 22:16:47

guoma要是能帮我搭一下PHP环境就好了

guoma 发表于 2025-3-28 22:20:57

jasonshu2025 发表于 2025-3-28 22:16
guoma要是能帮我搭一下PHP环境就好了
给你个php测试网站:https://run.uv.cc/
测试代码时,将代码中header("location:".xxx)注释掉,只echo或print_r

10086 发表于 2025-3-28 22:20:59

guoma 发表于 2025-3-28 22:09
bjws4k无需解密。在$stream_url = json_decode($d,1)['data']['video_stream']['stream_url'];后加个判 ...

感谢guoma,大佬威武

jasonshu2025 发表于 2025-3-28 22:24:44

guoma 发表于 2025-3-28 22:20
给你个php测试网站:https://run.uv.cc/
测试代码时,将代码中header("location:".xxx)注释掉,只echo或pr ...

我是小白,想在vps或者自己的服务器上搭建PHP环境,之前装过一个docker,但是不会装PHP扩展。服务器上有1panel ,但自己也没能搞定

lj98 发表于 2025-3-29 00:49:21

同求同求{:4_89:}

aallsskkgg 发表于 2025-3-29 16:20:14

guoma 发表于 2025-3-28 22:09
bjws4k无需解密。在$stream_url = json_decode($d,1)['data']['video_stream']['stream_url'];后加个判 ...

这样改对吗,看不了,帮帮我
<?php
error_reporting(0);
$id = $_GET['id']??'bjwy';
$n = [
    'bjws' => '5755n511tbk8flo40l4c71l0sdf',//北京卫视
    'bjwy' => '54db6gi5vfj8r8q1e6r89imd64s',//BRTV文艺
    ];

$t = time();
$sign = substr(md5($n[$id]."151".$t.'TtJSg@2g*$K4PjUH'),0,8);
$url = "https://pc.api.btime.com/video/play?id=$n[$id]&sign=$sign&timestamp=$t&type_id=151";
$d = file_get_contents($url);
$stream_url = json_decode($d,1)['data']['video_stream']['stream_url'];
if($id=='bjws4k'){
   $playurl = $stream_url;
   } else {
   $playurl = base64_decode(base64_decode(strrev($stream_url)));
   }
$playurl = base64_decode(base64_decode(strrev($stream_url)));
if($playurl == null){
   echo "因版权方要求,暂无直播";
   } else {
   header('location:'.$playurl);
   //print_r($playurl);
   }
?>

10086 发表于 2025-3-29 17:12:07

本帖最后由 10086 于 2025-3-29 17:13 编辑

aallsskkgg 发表于 2025-3-29 16:20
这样改对吗,看不了,帮帮我

你id不对。。
你把下面那个判断句的bjws4k改成bjws
然后已经有if判断了下面那句记得删一下

fxgsfxgs 发表于 2025-3-29 17:13:55

aallsskkgg 发表于 2025-3-29 16:20
这样改对吗,看不了,帮帮我

if($playurl == null){
   echo "因版权方要求,暂无直播";
   } else {
   header('location:'.$playurl);
   //print_r($playurl);
   }
改为
   header('location:'.$playurl);
   //print_r($playurl);
页: [1] 2
查看完整版本: 请求guoma大佬更新北京台代码