本帖最后由 guoma 于 2023-9-17 10:08 编辑
TingFM播放线路获取源码:
- <?php
- error_reporting(0);
- $id = isset($_GET['id'])?$_GET['id']:3;
- $t = isset($_GET['t'])?$_GET['t']:'';//默认:mp3;hls
- $context = stream_context_create(['http'=>['method'=>"GET",'header'=>["user-agent: (Windows NT 6.1; WOW64)"]]]);
- $d = file_get_contents('https://tingfm.com/', null, $context);
- preg_match('|"token":"(.*?)"|',$d,$k);
- $m = curl_init("https://tingfm.com/wp-json/query/wndt_streams?post_id={$id}&in_web=true");
- curl_setopt($m, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($m, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($m, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($m, CURLOPT_HTTPHEADER, ["stream-token: $k[1]","user-agent: Mozilla/5.0"]);
- $d = curl_exec($m);
- curl_close($m);
- $v = json_decode($d,1)['data']['streams'];
- $hls = $v[0]['url'];
- $mp3 = $v[1]['url'];
- if($t=="mp3"||$t=='') {
- header('location:'.$mp3);
- //echo $mp3;
- }
- if($t=="hls") {
- header('location:'.$hls);
- //echo $hls;
- }
- ?>
复制代码
调用:
xxx,php?id=id 获取mp3线路;
xxx,php?id=id&t=hls 获取m3u8线路;
发帖注意事项
请勿胡乱发帖:https://www.right.com.cn/forum/thread-8307840-1-1.html
账户手机验证:https://www.right.com.cn/forum/home.php?mod=spacecp&ac=plugin&id=jzsjiale_sms:home
|