美文网首页
QQ音乐搜索音乐和试听播放

QQ音乐搜索音乐和试听播放

作者: 暖暖的走 | 来源:发表于2018-03-23 10:33 被阅读0次

    基于thinkphp的代码

    1:搜索歌曲

    接口:

    $url="http://soso.music.qq.com/fcgi-bin/fcg_search_xmldata.fcg?source=10&w=".$name."&type=qry_song&out=json&p=1&perpage=50&ie=utf-8&uin=767943994&inCharset=GB2312&outCharset=GB2312&hostUin=767943994¬ice=0&needNewCode=0&format=jsonp&platform=musicbox&g_tk=1427201588";

    ext_json_decode方法

    public function ext_json_decode($str, $mode=false){

    if(strpos($str,'},]}')){

    $str = str_replace('},]}','}]}',$str);

    }

    if(preg_match('/\w:/', $str)){

    //  $str = preg_replace('/(\w+):/is', '"$1":', $str);

    $str = preg_replace('/([^"\{\[\:\,]+)(:(?:true|false|\d|"|\{|\[))/', '"$1"$2',$str);

      }

    return json_decode($str, $mode);

    }

    2:歌曲播放:首先要获取vkey

    1:获取vkey

    $url = 'https://c.y.qq.com/base/fcgi-bin/fcg_music_express_mobile3.fcg';

    2:点击请求vkey的js

    $src = "http://dl.stream.qqmusic.qq.com/"+info['filename']+"vkey="+info['vkey']+"&guid="+guid+"&fromtag=66";

    相关文章

      网友评论

          本文标题:QQ音乐搜索音乐和试听播放

          本文链接:https://www.haomeiwen.com/subject/ycuudxtx.html