blog/source/_posts/【API】网易云音乐搜索下载API.md
2024-02-01 19:45:45 +08:00

126 lines
3.2 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 【API】网易云音乐搜索下载API
date: 2018/2/19 10:35
tags: [API, 网易云音乐]
categories: 技术
permalink: 44.html
---
只是随便很简单就能抓到的接口的。
接口更新了!必须加上 `&version=1` 否则都是失效的歌曲地址!!!!
网易旗下有个 网易博客 跟 LOFTER 这里并不是宣传QWQ 在发表日志什么的时候,可以插入网易音乐
我们打开浏览器F12 转到 NetWork , 然后随便输入一个歌曲名然后我们就得到了这个API,简化一下接口:接口地址为:
<a href="https://s.music.163.com/search/get/">https://s.music.163.com/search/get/</a>
对应参数:
<div>
<table title="" border="1" summary="" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>名称</td>
<td></td>
<td>作用</td>
</tr>
<tr>
<td>version</td>
<td>
<p lang="en-US">1</p>
</td>
<td>必填,不然查询到的歌曲地址是失效的。</td>
</tr>
<tr>
<td>
<p lang="en-US">src</p>
</td>
<td>
<p lang="en-US">blog</p>
</td>
<td><span lang="zh-CN">这个也不是必填,网易博客是</span><span lang="en-US">blog</span><span lang="zh-CN"></span><span lang="en-US">lofter</span><span lang="zh-CN">就是</span><span lang="en-US">lofter</span></td>
</tr>
<tr>
<td>
<p lang="en-US">type</p>
</td>
<td>
<p lang="en-US">1</p>
</td>
<td><span lang="zh-CN">这是个必填的,默认就好了</span><span lang="en-US">~</span></td>
</tr>
<tr>
<td>
<p lang="x-none">s</p>
</td>
<td>skying</td>
<td><span lang="zh-CN">搜索内容不用多说啦,</span> <span lang="zh-CN">搜索歌名,</span> <span lang="zh-CN">歌手名,</span> <span lang="zh-CN">专辑名,</span> <span lang="zh-CN">应该事都没问题的</span><span lang="en-US">~</span></td>
</tr>
<tr>
<td>
<p lang="en-US">limit</p>
</td>
<td>
<p lang="en-US">10</p>
</td>
<td><span lang="zh-CN">返回搜索结果数量,</span> <span lang="zh-CN">我也没有找上限是多少。自己试试吧</span></td>
</tr>
<tr>
<td>
<p lang="en-US">offset</p>
</td>
<td>
<p lang="en-US">0</p>
</td>
<td><span lang="zh-CN">搜索结果页数</span><span lang="en-US">~</span><span lang="zh-CN">,一页显示不完就有多几页啦。</span> <span lang="zh-CN"></span><span lang="en-US">0</span><span lang="zh-CN">开始哟</span></td>
</tr>
</tbody>
</table>
</div>
例: https://s.music.163.com/search/get/?type=1&version=1&s=skying&limit=10&offset=0
返回格式为 JSON 有些搜索结果有点长
```json
{
result: {
songCount: 1500,
songs: [
{
id: 499213223, //网易歌曲搜索ID
name: "Skying",
artists: [
{
id: 12418577,//网易歌手ID
name: "元小汐",//歌手名称
picUrl: null//歌手图片
},
{
id: 12271611,//网易歌手ID
name: "Carla",//歌手名称
picUrl: null//歌手图片
}
],
album: {
id: 35963214,//网易歌曲ID
name: "Skying",//网易歌曲名称
artist: {
id: 0,
name: "",
picUrl: null
},
picUrl: "https://p1.music.126.net/Z_Hte_f1iajCgzricHfWOA==/109951163004340752.jpg"
},//网易歌曲图片
audio: "https://music.163.com/song/media/outer/url?id=499213223",//网易歌曲mp3链接
djProgramId: 0,
page: "https://music.163.com/m/song/499213223"
},//网易云音乐网页
]
},
code: 200
}
```
经测试全部可以支持https访问 API接口也行 具体测试嘛QWQ