Blog使用的音乐Api

🎵 Music API 文档(基于 Cloudflare Worker)

本 API 提供统一的音乐数据访问接口,支持多平台(当前为 bilibilinetease)。
所有接口均返回 JSON,且支持跨域(Access-Control-Allow-Origin: *)。


📌 基础信息

  • Base URLhttps://mbma.my20130910.workers.dev
  • 响应格式application/json; charset=utf-8
  • 跨域支持:是
  • 错误格式统一
1
2
3
{
"error": "error message"
}

📚 API 列表

方法 路径 描述
GET /search 搜索歌曲/视频
GET /song 获取歌曲播放信息(APlayer 友好)
GET /lyric 获取歌词

🎯 1. 搜索接口 /search

请求方式

1
GET /search?keyword=xxx&page=1&source=bilibili

请求参数

参数 类型 必填 默认值 说明
keyword string 搜索关键词
page number 1 页码(从 1 开始)
source string bilibili 数据源:bilibilinetease

成功返回示例

1
2
3
4
5
6
7
8
9
10
11
12
{
"data": [
{
"id": "BVxxxx",
"title": "歌曲标题",
"artist": "作者",
"cover": "https://...",
"source": "bilibili"
}
],
"isEnd": false
}

⚠ 注意:不同平台返回字段可能略有差异,但 Worker 不做二次加工,直接返回插件结果。

错误返回

1
2
3
{
"error": "keyword required"
}

1
2
3
{
"error": "some error message"
}

🎯 2. 获取歌曲 /song

请求方式

1
GET /song?id=xxx&quality=standard&source=bilibili

请求参数

参数 类型 必填 默认值 说明
id string 歌曲 ID(平台原始 ID)
quality string standard 音质(由插件决定是否支持)
source string bilibili 数据源:bilibilinetease

成功返回示例(APlayer 友好)

1
2
3
4
5
6
7
8
9
{
"id": "1954890276",
"url": "https://music.163.com/song/media/outer/url?id=1954890276.mp3",
"name": "歌曲名",
"artist": "歌手",
"cover": "https://...",
"lrc": "歌词文本",
"error": null
}

⚠ 注意:

  • B 站返回的 url 可能是 .m4s(DASH),浏览器无法直接播放。
  • 网易云外链可能不稳定(偶尔 404 / HTML)。
  • Worker 不做任何代理或修复,只返回插件结果。

错误返回

1
2
3
4
5
{
"id": "xxx",
"url": "",
"error": "TypeError: xxx"
}

🎯 3. 获取歌词 /lyric

请求方式

1
GET /lyric?id=xxx&source=netease

请求参数

参数 类型 必填 默认值 说明
id string 歌曲 ID
source string bilibili 数据源

成功返回示例

1
2
3
4
5
{
"raw": "[00:00.00]歌词内容",
"translation": "[00:00.00]翻译内容",
"error": null
}

错误返回

1
2
3
4
5
{
"raw": "",
"translation": "",
"error": "some error"
}

⚠ 全局错误处理

Worker 捕获所有异常并返回:

1
2
3
{
"error": "error message"
}

状态码为 500


Blog使用的音乐Api
https://mcldy.github.io/2026/02/07/Blog使用的MusicApi/
作者
Mcldy
发布于
February 7, 2026
更新于
February 7, 2026
许可协议