3

网易云解析

 2 years ago
source link: https://paugram.com/help/netease
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用方法:

调用地址 https://api.paugram.com/netease/ 并输入参数 idtitle,即可获得一段歌曲 JSON 信息。

如果您已开始使用本 API 服务,则默认视为遵守 本约定

音乐版权归网易云音乐所有,本站不为滥用本 API 进行违规操作者承担责任。

建议使用 id 的方式获得歌曲信息,性能相对较好。

参数 要求 描述 id 二选一 有效的音乐 ID,例:517567145 音乐 ID title 二选一 可以搜索到且无版权限制的歌曲,暂无加速 音乐名称 playlist(施工中) 有多首音乐的音乐列表 音乐列表 play 参数值为 true 则启用跳转 是否直接跳转到歌曲所在地址

返回内容:

参数名称 描述 值 id 音乐 ID string title 音乐名称 string artist 音乐艺术家 string album 音乐专辑名称 string cover 音乐专辑图片链接(https) string link 音乐源地址链接 string lyric 音乐 LRC 歌词内容 string sub_lyric 翻译版 LRC 歌词内容(如果有) string served 是否为 VIP 或无版权歌曲(测试功能) true false

通过 ID 获得一首歌的信息

https://api.paugram.com/netease/?id=517567145

返回的是:

{
    "id": 517567145,
    "title": "初登校",
    "artist": "橋本由香利",
    "album": "ひなこのーと COMPLETE SOUNDTRACK",
    "cover": 封面地址,
    "lyric": 歌词内容,
    "sub_lyric": 翻译歌词内容,
    "link": 音乐地址
}

通过 ID 获得一首歌,并跳转到实际地址

https://api.paugram.com/netease/?id=517567145&play=true

通过歌名获得一首歌的信息

https://api.paugram.com/netease/?title=Paradise

返回的是:

{
    "id": 17177380,
    "title": "Paradise",
    "artist": "Coldplay",
    "album": "Paradise",
    "cover": 封面地址,
    "lyric": 歌词内容,
    "sub_lyric": 翻译歌词内容,
    "link": 音乐地址
}

结合 Kico Style 和 Kico Player 使用本 API

ks.ajax({
    method: "GET",
    url: "https://api.paugram.com/netease/" + "?id=" + id,
    success: function (req){
        var item = JSON.parse(req.response);
        声明的播放器.add([item]);
    },
    failed: function (req){
        ks.notice("获取音乐信息错误了!", {color: "red"});
    }
});

测试小工具:

使用 Kico Player 播放音乐

常见问题:

为什么音乐地址是 http 协议?如何避免网站小绿锁消失?

答:为了保证服务器的运行效率,歌曲链接均为网易服务器即时生成返回,不提供代理与转发。在你的站点 head 下添加如下代码,即可完美解决此问题,任何 http 请求都会自动尝试连接到 https

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"/>



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK