灵感来源于@码迷@九霄道长

20201003144044.png

<?php
/*
 * @Author: Qicloud
 * @Date: 2020-10-13 20:59:00
 * @Title: QQ音乐
 * @Project: 音乐直链解析
 * @QQ: 66547997
 * @当浑浊变成一种常态,清白就是一种罪。
 */
$song_id = @$_GET['id'];
if ($song_id == "") {
        print json_encode(array('code'=>'200','msg' => 'id参数为空','purl'=>'null'), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
} else {
    $url = file_get_contents('https://u.y.qq.com/cgi-bin/musicu.fcg?g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq.json&needNewCode=0&data={"req":{"module":"CDN.SrfCdnDispatchServer","method":"GetCdnDispatch","param":{"guid":"8348972662","calltype":0,"userip":""}},"req_0":{"module":"vkey.GetVkeyServer","method":"CgiGetVkey","param":{"guid":"8348972662","songmid":["' . $song_id . '"],"songtype":[1],"uin":"0","loginflag":1,"platform":"20"}},"comm":{"uin":0,"format":"json","ct":24,"cv":0}}');
    $arr = json_decode($url, true);
    $rand = rand(1, 4);
    //echo $arr['req']['data']['sip'][$rand] . $arr['req_0']['data']['midurlinfo'][0]['purl'];

    $array = array(
        'code' => '200',
        'msg' => 'success',
        //歌曲直链
        'purl' => $arr['req']['data']['sip'][$rand] . $arr['req_0']['data']['midurlinfo'][0]['purl']
    );
    print json_encode($array, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
}

调用方法:http://127.0.0.5/qqmusic.php?id=001RbEYQ4VeWvL
返回格式:

{"code":"200","msg":"success","purl":"http://111.6.166.27/amobile.music.tc.qq.com/C400001RbEYQ4VeWvL.m4a?guid=8348972662&vkey=71C722E08B6D758DD6E708C7405FE2890C00465DF5476E2B0CE8EA76C6A85CCDE6F3999FFBC1A175F62FF3BA13A80BFB552451EAF9010A0A&uin=0&fromtag=66"}
最后修改:2020 年 10 月 14 日 12 : 20 AM
如果觉得我的文章对你有用,请随意赞赏