搜 歌
歌单导入
导入分类
按 ID / 链接解析
♪ 歌词将在播放时显示
播放列表
src 只传 s1/s2/s3 匿名编号;无需任何密钥;接口带来源校验(浏览器同源或 pages.dev 来源自动放行)+ 单 IP 限流(30 次/分钟),超限返回 429。响应均为 UTF-8 JSON。GET /api/resolve| 参数 | 说明 |
|---|---|
src | 可选,解析源编号 s1|s2|s3,缺省自动按序尝试 |
server | netease|tencent|kugou|kuwo |
type | url 播放直链 · pic 封面 · lrc 歌词(别名 lyric)· song 元数据 · search 搜索 · playlist 歌单 |
id | 歌曲/歌单 ID(搜索与歌单接口也可用 id=关键词) |
# 获取播放直链(推荐前端用 <audio> 直接播放)
curl "https://openmusic.cc.cd/api/resolve?server=netease&type=url&id=1848223017"
→ {"ok":true,"url":"https://...mp3"}
# 搜索(返回 [{name,artist,url,id,pic,lrc}])
curl "https://openmusic.cc.cd/api/resolve?server=netease&type=search&id=晴天"
# 封面 / 歌词(直接输出图片 / 文本)
curl "https://openmusic.cc.cd/api/resolve?server=netease&type=pic&id=109951169134518175" -o cover.jpg
curl "https://openmusic.cc.cd/api/resolve?server=netease&type=lrc&id=1848223017"
# 歌单全量曲目(id 为网易云歌单 ID)
curl "https://openmusic.cc.cd/api/resolve?server=netease&type=playlist&id=3778678"
// 浏览器 JS 调用
const r = await fetch('https://openmusic.cc.cd/api/resolve?server=netease&type=url&id=' + id);
const j = await r.json();
if (j.ok) audio.src = j.url; // j.url 为可直接播放的 CDN 直链
GET /api/ncmsearch?q=关键词网易官方源聚合搜索(带 10 分钟边缘缓存)。返回 {ok,count,songs:[{id,name,artist}]},每曲可用 type=url&id= 拿直链。
curl "https://openmusic.cc.cd/api/ncmsearch?q=晴天%20周杰伦"
→ {"ok":true,"count":20,"songs":[{"id":"186855","name":"晴天","artist":"周杰伦"},...]}
GET /api/kgspecial?gcid=xxx酷狗歌单分享链接里的 gcid → 歌单 ID 与歌单名,再配合 type=playlist&server=kugou 拉取曲目(每首含 hash,经转换可去网易云匹配)。
curl "https://openmusic.cc.cd/api/kgspecial?gcid=3z14ysn7hzgz067"
→ {"ok":true,"specialid":7692393,"name":"歌单名","count":151}
GET /api/plmeta?id=网易云歌单ID歌单名称 + 网易云官方分类标签(华语/流行/治愈…,尽力提取)。
curl "https://openmusic.cc.cd/api/plmeta?id=3778678"
→ {"ok":true,"id":"3778678","name":"热歌榜","tags":[]}
POST /api/share · GET /api/share?code=<code>(也支持 /api/share/<code>)把本站播放列表分享给其它网页,或从其它网站拉取。此接口 CORS 全开(*),任何来源可调用。分享码 1 小时有效。
# 分享(提交 [{server,id,name,artist}] 数组)
curl -X POST "https://openmusic.cc.cd/api/share" \
-H "Content-Type: application/json" \
-d '[{"server":"netease","id":"1848223017","name":"歌名","artist":"歌手"}]'
→ {"ok":true,"code":"Ab12Cd","count":1}
# 取回(任意网页 fetch 均可,带 CORS)
fetch("https://openmusic.cc.cd/api/share?code=Ab12Cd")
.then(r=>r.json()).then(j=>console.log(j.tracks))
| 状态码 | 含义 |
|---|---|
400 | 参数缺失或非法 |
403 | 来源校验失败(非本站 / pages.dev / 本地来源) |
429 | 超过限流(单 IP 30 次/分钟),稍后再试 |
502 | 上游解析失败(源临时不可用或版权限制),可换 src 重试 |
说明:解析源仅以匿名编号 s1/s2/s3 提供,内部提供方与转换逻辑不对外暴露;单曲直链为临时 CDN 地址,建议使用时实时解析,勿长期缓存。