【音乐】网易云单曲解析


接口地址

https://api.cenguigui.cn/api/netease/music_v1.php?id=歌曲id&type=json/mp3/pic/mv/lyric&level=standard/exhigh/lossless/hires/jyeffect/sky/jymaster

返回格式

JSON

请求方式:

GET

请求示例:

https://api.cenguigui.cn/api/netease/music_v1.php?id=1463165983&type=json&level=standard

参数说明

名称 必填 类型 说明
idid歌曲id
jsonjson/mp3/pic/mv/lyric,默认json
level standard(标准音质), exhigh(极高音质), lossless(无损音质), hires(Hi-Res音质), jyeffect(高清环绕声), sky(沉浸环绕声), jymaster(超清母带),默认lossless(无损音质)

返回数据

{
    "code": 200,
    "msg": "解析成功",
    "data": {
        "id": "1463165983",
        "name": "天外来物",
        "artist": "薛之谦",
        "album": "天外来物",
        "duration": "04:17",
        "size": "3.93MB",
        "format": "低音质 MP3",
        "pic": "http://p2.music.126.net/MgH6SepYHboKPr6FR8yg-w==/109951167040040692.jpg",
        "url": "https://m701.music.126.net/20240721213841/fe53bce0f0562f95bd3ff5ceecd65f67/jdymusic/obj/wo3DlMOGwrbDjj7DisKw/25981412262/0505/5133/b7ab/d5c9b4b7c8303461cbff87d44bd1e312.mp3",
        "lyric": "[00:00.000] 作词 : 薛之谦\n[00:01.000] 作曲 : 罗小黑\n[00:02.000] 编曲 : 周以力\n[00:03.000] 制作人 : 周以力/郑伟\n[00:18.042]你降落的 太突然了\n[00:24.240]我刚好呢 又路过了\n[00:32.325]机会难得 又主观觉得\n[00:38.725]想明抢 又碰不得\n[00:46.157]你带来了 我的快乐\n[00:53.157]让这世界 有点颜色\n[01:00.444]我好想指责 你太随意了\n[01:06.991]宝物该有人捧着  你是不是我的\n[01:17.333]你像 天外来物一样 求之不得\n[01:24.269]你在世俗里的名字 不重要了\n[01:31.516]正好 我隐藏的人格是契而不舍\n[01:38.299]直到蜂拥而至的人都透明了\n[01:45.943]我在 不近又不远处\n[01:49.925]用明天换你 靠近我\n[02:07.554]你占领了 我的快乐\n[02:14.406]和这世界 已没有瓜葛\n[02:21.639]任事物干渴  都褪去颜色\n[02:28.340]只有你是天蓝色  我开始找你了\n[02:40.569]会像 天外来物一样 失而复得\n[02:47.769]你在世俗里的名字  被人用了\n[02:54.662]反正 我隐藏的人格是契而不舍\n[03:01.730]直到蜂拥而至的人都透明了\n[03:08.793]我在 不近又不远处\n[03:12.651]用明天换你 靠近我\n[03:18.765]你就像 天外来物一样 求之不得\n[03:26.717]我在世俗里的描写被取笑了\n[03:33.681]反正我隐藏的人格是非你不可\n[03:40.352]直到别有用心的人都透明了\n[03:47.895]我在 不近又不远处\n[03:52.044]用明天换你 靠近我\n[04:12.212] 编曲 : 周以力\n[04:12.628] 制作人 : 周以力/郑伟\n[04:13.044] 吉他 : 张淞\n[04:13.460] 大提琴 : 郎莹\n[04:13.876] 鼓 : 褚伟明\n[04:14.292] 贝斯 : 努而德柯\n[04:14.708] 人声录音 : 郑伟 夏之炜 吴身宝\n[04:15.124] 人声编辑 : 郑伟\n[04:15.540] 人声录音室 : 上海广播大厦200studio\n[04:15.956] 乐器录音棚 : soundhub studio\n[04:16.372] 混音 : 全相彦\n[04:16.788] 母带 : 全相彦\n",
        "mv_info": {
            "mv": "https://vodkgeyttp8.vod.126.net/cloudmusic/e0c3/core/c425/a0ebb346a2820d30b614068c0faba244.mp4?wsSecret=1d287f1b6f3a7926cc02d4ef12476bcf&wsTime=1721567621",
            "size": "55.50MB",
            "br": 1080
        },
        "copyright": {
            "msg": "源码编译:笒鬼鬼 2023.10.7",
            "api_vers": "music_v1",
            "type": "单曲解析"
        }
    }
}

调用实例

<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
header('Access-Control-Max-Age: 86400');
header('Content-Type: application/json; charset=utf-8');


// 获取参数
$id = $_REQUEST['id'];
$type = $_REQUEST['type'];
$level = $_REQUEST['level'] ? $_REQUEST['level'] : 'lossless';
// 请求接口
define('QQ_Key', 'https://api.cenguigui.cn/api/netease/music_v1.php?id=' . $id . '&type=' . $type . '&level=' . $level . ''); //请求会员接口
// 请求会员接口
$url = json_decode(curl(QQ_Key . "$vip"), true);
// 返回结果
exit(json_encode($url, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));


function curl($url, $paras = [])
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    // curl_setopt($curl, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.ip(), 'CLIENT-IP:'.ip()));  
    if (isset($paras['Header'])) {
        $Header = $paras['Header'];
    } else {
        $Header[] = "Accept:*/*";
        $Header[] = "Accept-Encoding:gzip,deflate,sdch";
        $Header[] = "Accept-Language:zh-CN,zh;q=0.8";
        $Header[] = "Connection:close";
    }
    curl_setopt($ch, CURLOPT_HTTPHEADER, $Header);
    if (isset($paras['ctime'])) { // 连接超时
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $paras['ctime']);
    } else {
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
    }
    if (isset($paras['rtime'])) { // 读取超时
        curl_setopt($ch, CURLOPT_TIMEOUT, $paras['rtime']);
    }
    if (isset($paras['post'])) {
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $paras['post']);
    }
    if (isset($paras['header'])) {
        curl_setopt($ch, CURLOPT_HEADER, true);
    }
    if (isset($paras['cookie'])) {
        curl_setopt($ch, CURLOPT_COOKIE, $paras['cookie']);
    }
    if (isset($paras['refer'])) {
        if ($paras['refer'] == 1) {
            curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f=');
        } else {
            curl_setopt($ch, CURLOPT_REFERER, $paras['refer']);
        }
    }
    if (isset($paras['ua'])) {
        curl_setopt($ch, CURLOPT_USERAGENT, $paras['ua']);
    } else {
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");
    }
    if (isset($paras['nobody'])) {
        curl_setopt($ch, CURLOPT_NOBODY, 1);
    }
    //curl_setopt($ch, CURLOPT_ENCODING, "gzip");
    curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    if (isset($paras['GetCookie'])) {
        curl_setopt($ch, CURLOPT_HEADER, 1);
        $result = curl_exec($ch);
        preg_match_all("/Set-Cookie: (.*?);/m", $result, $matches);
        $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
        $header = substr($result, 0, $headerSize); //状态码
        $body = substr($result, $headerSize);
        $ret = array(
            "cookie" => $matches, "body" => $body, "Header" => $header, 'code' => curl_getinfo($ch, CURLINFO_HTTP_CODE),
        );
        curl_close($ch);
        return $ret;
    }
    $ret = curl_exec($ch);
    if (isset($paras['loadurl'])) {
        $Headers = curl_getinfo($ch);
        if (isset($Headers['redirect_url'])) {
            $ret = $Headers['redirect_url'];
        } else {
            $ret = false;
        }
    }
    curl_close($ch);
    return $ret;
}

function ip()
{
    $ip_long = array(
        array('607649792', '608174079'),
        array('1038614528', '1039007743'),
        array('1783627776', '1784676351'),
        array('2035023872', '2035154943'),
        array('2078801920', '2079064063'),
        array('-1950089216', '-1948778497'),
        array('-1425539072', '-1425014785'),
        array('-1236271104', '-1235419137'),
        array('-770113536', '-768606209'),
        array('-569376768', '-564133889'),
    );
    $rand_key = mt_rand(0, 9);
    return $ip = long2ip(mt_rand($ip_long[$rand_key][0], $ip_long[$rand_key][1]));
}

示例代码

						
黑暗交替
本站已安全运行449天7时7分39秒

赞助一下