【码】音乐自动采集程序
in 代码片段 with 0 comment

【码】音乐自动采集程序

in 代码片段 with 0 comment

代码来源:自己整理编写
说明:用于自动采集音乐直链。

<?php
/**
 * 点歌服务类
 */
namespace Common\Functions;
class Music{
    function Music($_info){
        $login_url = 'http://sou.kuwo.cn/ws/NSearch?key='.$_info.'&type=all';
        $contents = curlGet($login_url);
        preg_match("/http:\/\/www.kuwo.cn\/yinyue\/(.*)\/\" title/",$contents,$arr);
        curl_close($ch);

        $url="http://player.kuwo.cn/webmusic/st/getNewMuiseByRid?rid=MUSIC_".$arr[1];
        $contents = curlGet($url);
        preg_match("/<mp3dl>(.*)<\/mp3dl>/",$contents,$mp3dl);
        preg_match("/<mp3path>(.*)<\/mp3path>/",$contents,$mp3path);
        preg_match("/<singer>(.*)<\/singer>/",$contents,$singer);
        preg_match("/<mp3size>(.*)<\/mp3size>/",$contents,$mp3size);
        preg_match("/<name>(.*)<\/name>/",$contents,$name);
        $mp3url = "http://".$mp3dl[1]."/resource/".$mp3path[1];
        curl_close($ch);
        return array( array(
                "歌名:".$name[1],
                "歌手:".$singer[1]."\n歌曲大小:".$mp3size[1],
                $mp3url,
                $mp3url,
                ''
        ),'music');
    }    
}
Comments are closed.