php 音悦台解析接口源码,主要是对采集视频有用

<?php
 
header('Content-type: text/json;charset=utf-8');
if(isset($_GET['vid'])){
$html=http_curl('http://ext.yinyuetai.com/main/get-h-mv-info?json=true&videoId='.$_GET['vid']);
$r=json_decode($html,true);
print_r($r);
$mp4=$r['videoInfo']['coreVideoInfo']['videoUrlModels'][count($r['videoInfo']['coreVideoInfo']['videoUrlModels'])-1]['videoUrl'];
//header("location:".$mp4);  
 
echo $mp4;
}
function http_curl($url){
    $curl = curl_init();
    curl_setopt($curl,CURLOPT_URL,$url);
    curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,30);
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
    $data=curl_exec($curl);
    curl_close($curl);
    return $data;
}
?>


下边的是测试的

<?php
//使用方法 http://localhost/yinyuetai.php?vid=2765558
// 作者:风云无忌
// 接口具有时效性,因官方改版可能会失效
 
header('Content-type: text/json;charset=utf-8');
if(isset($_GET['vid'])){
$html=http_curl('http://ext.yinyuetai.com/main/get-h-mv-info?json=true&videoId='.$_GET['vid']);
$r=json_decode($html,true);
$mp4=$r['videoInfo']['coreVideoInfo']['videoUrlModels'][count($r['videoInfo']['coreVideoInfo']['videoUrlModels'])-1]['videoUrl'];
header("location:".$mp4);  
}
function http_curl($url){
    $curl = curl_init();
    curl_setopt($curl,CURLOPT_URL,$url);
    curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,30);
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
    $data=curl_exec($curl);
    curl_close($curl);
    return $data;
}
?>

输出的结果是

Array
(
    [message] => 
    [error] => 
    [logined] => 
    [videoInfo] => Array
        (
            [pageUrl] => http://v.yinyuetai.com/video/2765558
            [secretKeyUri] => http://api.yinyuetai.com/mv/secret-key
            [coreVideoInfo] => Array
                (
                    [videoId] => 2765558
                    [videoName] => Ting A Ling 官方版
                    [headImage] => http://img4.yytcdn.com/video/mv/170105/2765558/-M-fc7447cb4ef41cf8b1702e24a4191b31_120x67.jpg
                    [bigHeadImage] => http://img4.yytcdn.com/video/mv/170105/2765558/-M-fc7447cb4ef41cf8b1702e24a4191b31_640x360.jpg
                    [videoUrlModels] => Array
                        (
                            [0] => Array
                                (
                                    [bitrateType] => 1
                                    [bitrate] => 772
                                    [qualityLevel] => hc
                                    [qualityLevelName] => 流畅
                                    [QualityLevelName] => 流畅
                                    [videoUrl] => http://hc.yinyuetai.com/uploads/videos/common/23A0015967F8BAEE9E3E4DB1642D2922.mp4?sc=995e533001fab560&br=772&vid=2765558&aid=3972&area=ML&vst=0
                                    [fileSize] => 21362320
                                    [sha1] => 65a71b32c37dcb8db97986f4b155ad6699d280c9
                                    [md5] => cf9c286c117d8332ba7e22d7eb5cd4d7
                                )
 
                            [1] => Array
                                (
                                    [bitrateType] => 2
                                    [bitrate] => 1090
                                    [qualityLevel] => hd
                                    [qualityLevelName] => 高清
                                    [QualityLevelName] => 高清
                                    [videoUrl] => http://hd.yinyuetai.com/uploads/videos/common/0F7D01596C547EBF0CFB189211E8D810.mp4?sc=7d48406b5570ebf9&br=1090&vid=2765558&aid=3972&area=ML&vst=0
                                    [fileSize] => 30128711
                                    [sha1] => 010bd3f6662960baf6f29e3188d707eded04214c
                                    [md5] => 1beb6fc9a994469cfea247b47edc45d2
                                )
 
                            [2] => Array
                                (
                                    [bitrateType] => 3
                                    [bitrate] => 3081
                                    [qualityLevel] => he
                                    [qualityLevelName] => 超清
                                    [QualityLevelName] => 超清
                                    [videoUrl] => http://he.yinyuetai.com/uploads/videos/common/90E901596C547EB8CD39CF5283392940.mp4?sc=1d4cc17898759a5e&br=3081&vid=2765558&aid=3972&area=ML&vst=0
                                    [fileSize] => 85160309
                                    [sha1] => 0a27d2d85b7b068a2b32e43a279ea1071b21620d
                                    [md5] => 0b2d4faec857332287aa497311860db0
                                )
 
                        )
 
                    [duration] => 221
                    [artistIds] => 3972
                    [artistNames] => 江映蓉
                    [threeD] => 
                    [error] => 
                    [errorMsg] => 
                    [source] => music_video
                    [modelType] => common
                )
 
        )
 
)
 
http://he.yinyuetai.com/uploads/videos/common/90E901596C547EB8CD39CF5283392940.mp4?sc=1d4cc17898759a5e&br=3081&vid=2765558&aid=3972&area=ML&vst=0


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值