php获取音悦台视频
程序员文章站
2024-01-11 12:38:04
...
PHP获取音悦台高清、超清MV。 演示地址:http://music.yuur.net 无 ?php$url=isset($_GET['url'])?trim($_GET['url']):'';//http://v.yinyuetai.com/video/2185713$time=$_SERVER['REQUEST_TIME'];$content = file_get_contents($url);//获取标题preg_match('/
PHP获取音悦台高清、超清MV。
演示地址:http://music.yuur.net
/i',$content,$title); //获取封面 preg_match('/property="og:image" content="([^"]*)".*?>/',$content,$images); //获取MV的ID preg_match('/[\d]+/',$url,$song_id); $title=$title[1]; $images=$images[1]; $song_id=$song_id[0]; //解析json $songurl = "http://www.yinyuetai.com/api/info/get-video-urls?callback=callback&videoId=".$song_id."&_=".$time; $data = file_get_contents($songurl); if (strpos($data, "callback") !== false){ $lpos = strpos($data, "("); $rpos = strrpos($data, ")"); $data = substr($data, $lpos + 1, $rpos - $lpos -1); } $json= json_decode($data,true); echo $title."
"; echo "流畅地址:".$json['hcVideoUrl']."
"; echo "高清地址:".$json['hdVideoUrl']."
"; echo "超清地址:".$json['heVideoUrl']."
"; echo ""; // 演示:http://music.yuur.net ?>