网易云音乐搜索
按歌名搜索网易云音乐,返回歌曲列表(含ID可用于解析/歌词接口)。
接口路径
/api/wy_search
◆ 接口信息
接口地址
/api/wy_search
请求方式
GET
返回格式
JSON
请求示例
https://cloud.xgiao.cn/api/wy_search?key=ABCDEF0123456789ABCDEF0123456789&search=到时说爱我&limit=15
◆ 请求参数
| 参数名 | 参数值 | 参数类型 | 是否必填 | 默认值 | 取值范围 | 参数描述 |
|---|---|---|---|---|---|---|
key |
YOUR_API_KEY | string | 必选 | - | 32位大写字母数字 | API Key,登录后在个人中心获取 |
search |
到时说爱我 | string | 必选 | - | 歌曲名称 | 音乐名称关键词 |
limit |
15 | number | 可选 | 10 | 1-50 | 返回数量,默认 10 首 |
◆ 返回参数
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
count |
number | 音乐总数量 |
songs |
array | 歌曲列表 |
songs[].id |
number | 歌曲ID |
songs[].name |
string | 歌名 |
songs[].artistsname |
string | 歌手 |
songs[].album |
string | 音乐专辑 |
songs[].duration |
number | 音乐时长(毫秒) |
◆ 返回示例
搜索"到时说爱我"返回 15 首
curl
curl "https://cloud.xgiao.cn/api/wy_search?key=ABCDEF0123456789ABCDEF0123456789&search=到时说爱我&limit=15"JSON
{
"code": 200,
"msg": "获取成功",
"data": {
"count": 300,
"songs": [
{ "id": 2105354877, "name": "到时说爱我", "artistsname": "王梓芷", "album": "到时说爱我", "duration": 210835 }
]
}
}◆ 错误示例
以下为常见请求错误时的返回结果:
缺少 API Key
code 40001
curl
curl "https://cloud.xgiao.cn/api/wy_search?search=到时说爱我"返回
{"code":40001,"msg":"缺少API Key","data":null}
API Key 无效
code 40002
curl
curl "https://cloud.xgiao.cn/api/wy_search?key=WRONG&search=到时说爱我"返回
{"code":40002,"msg":"API Key无效","data":null}
search 参数不能为空
code 40005
curl
curl "https://cloud.xgiao.cn/api/wy_search?key=ABCDEF0123456789ABCDEF0123456789"返回
{"code":40005,"msg":"search参数不能为空","data":null}
服务器内部错误
code 500
curl
curl "https://cloud.xgiao.cn/api/wy_search?key=ABCDEF0123456789ABCDEF0123456789&search=测试"返回
{"code":500,"msg":"服务器内部错误","data":null}