2年前 (2015-01-14)  码农区 |   抢沙发  213 
文章评分 1 次,平均分 5.0

最近忙于工作 博客都处于长草状态 看了下,一个月没有发文章扯淡了
闲时时候自己写了个acfun解析接口,因为之前的获取acfun视频vid(videoId)api接口已经无法使用;
每次获取vid还要curl一下,所以其实也就自己创建了个数据表,存放视频信息,方便自己调用
Array ( [url] => http://www.acfun.tv/v/ac1665535 [up] => 梦灵菌 [uid] => 804778 [aid] => 1665535 [vid] => 1833571 [page] => 1 [title] => 【东方MAD】众神异变的幻想乡 [image] => http://static.acfun.mm111.net/dotnet/artemis/u/cms/www/201501/101138433srv.jpg [jiexi] => http://jiexi.acfun.info/index.php?vid=1833571 [ssl] => https://ssl.acfun.tv/shizuku/jiexi/index.php?vid=1833571 [danmu] => https://ssl.acfun.tv/shizuku/danmaku/1833571 [info] => c )
只支持视频类(ac),剧集类(ab)不支持
这里只获取了up主,uid,aid,vid,页面数,标题,封面,两个视频解析地址(jiexi ssl),一个弹幕评论地址(danmu)
api地址:http://api.airdge.com/json/acfun.php

 

<?php
$jurl='http://api.airdge.com/json/acfun.php';
$data = array( 'url'=>$_GET['url']);
$json_data = postData($jurl, $data);
$json=json_decode($json_data,1);
print_r( $json);
function postData($url, $data)
{
$ch = curl_init();
$timeout = 300;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$handles = curl_exec($ch);
curl_close($ch);
return $handles;
}
?>

要解析acfun视频的话,只要获取视频解析地址(jiexi ssl)中的一个访问
{"code":200,"message":"request success.","success":true,"result":{"C20":{"quality":"\u5206\u6bb5_\u9ad8\u6e05_MP4","totalseconds":0,"totalbytes":0,"files":[{"type":"mp4","seconds":0,"bytes":0,"url":"http:\/\/video.dispatch.tc.qq.com\/50504907\/b0144rs83wy.p702.1.mp4?vkey=5A91FDA0DA5B352A535B8D01A575444CE5479552A4F89EF4B0D5AEF101D245ACB2863D136DA70036D8445722EC47A9C344B5B859E7CAF220","no":0}]},"C10":{"quality":"\u5206\u6bb5_\u6807\u6e05_MP4","totalseconds":0,"totalbytes":0,"files":[{"type":"mp4","seconds":0,"bytes":0,"url":"http:\/\/video.dispatch.tc.qq.com\/50504907\/b0144rs83wy.p703.1.mp4?vkey=35A047C69D8DD84B92EAEF87D54F246589121D9C5FEFD0A1C4463CC91888D81AE556CCC176A72FB95D95B9BF41147D8138CEC01D6A5E31BA","no":0}]},"C00":{"quality":"\u5206\u6bb5_\u6807\u6e05_MP4","totalseconds":0,"totalbytes":0,"files":[{"type":"mp4","seconds":0,"bytes":0,"url":"http:\/\/video.dispatch.tc.qq.com\/50504907\/b0144rs83wy.p703.1.mp4?vkey=35A047C69D8DD84B92EAEF87D54F246589121D9C5FEFD0A1C4463CC91888D81AE556CCC176A72FB95D95B9BF41147D8138CEC01D6A5E31BA","no":0}]},"C80":{"quality":"\u5206\u6bb5_\u6807\u6e05_MP4","totalseconds":0,"totalbytes":0,"files":[{"type":"mp4","seconds":0,"bytes":0,"url":"http:\/\/video.dispatch.tc.qq.com\/50504907\/b0144rs83wy.p703.1.mp4?vkey=35A047C69D8DD84B92EAEF87D54F246589121D9C5FEFD0A1C4463CC91888D81AE556CCC176A72FB95D95B9BF41147D8138CEC01D6A5E31BA","no":0}]},"C30":{"quality":"\u5206\u6bb5_\u8d85\u6e05_MP4","totalseconds":0,"totalbytes":0,"files":[{"type":"mp4","seconds":0,"bytes":0,"url":"http:\/\/video.dispatch.tc.qq.com\/50504907\/b0144rs83wy.p701.1.mp4?vkey=CCC69BA3280BB5CCD9BB6C217E3B10B1D37DD75D09492EEEC905D7C6008C671B2DA193A54C484C0275EB17EDFDD5A3334A3FB410DFFACA39","no":0}]}}}
想要获取高清的话,获取c20就行了
另外,acfun解析要放在国内空间才行

 

除注明外本站所有文章均为火星博客原创,本文地址http://www.fromars.com/118.html

就爱翻翻墙,寻找些新奇好玩的。 如果对建站有兴趣也欢迎加我微信:fromarss

发表评论

暂无评论

切换注册

登录

忘记密码 ?

切换登录

注册

扫一扫二维码分享