跳转到内容

LrcLib 接口

为了方便使用 LrcLib 协议 的播放器或插件直接接入 AMLL 词库所提供的兼容接口

兼容 LrcLib 格式的歌词响应结构

export interface LrclibSongItem {
/** 歌词唯一 ID */
id: number;
/** 歌曲名称 */
name: string;
/** 歌曲名称 */
trackName: string;
/** 歌手名称 */
artistName: string;
/** 专辑名称 */
albumName: string;
/**
* 歌词中出现的最高时间戳(秒)
*
* 注意非音频文件真实时长
*/
duration: number;
/** 是否为纯音乐 */
instrumental: false;
/** 纯文本歌词 */
plainLyrics: string;
/** LRC 歌词 */
syncedLyrics: string;
}
  • instrumental: 是否为纯音乐。固定返回 false
  • 歌曲名称、歌手名称和专辑名称只会取第一个值返回

在词库中模糊搜索,响应列表中最多返回前 50 条记录

GET/v1/lrclib/search

至少需要提供 track_name / q / artist_name / album_name 之一

参数名 类型 必填 说明
q string 全局通用搜索关键词
track_name string 歌曲名
artist_name string 歌手名
album_name string 专辑名

请求成功时返回 200 状态码及如下结构

type LrcLibSearchResponse = LrclibSongItem[];
示例响应
[
{
"id": 269710089745311,
"name": "ME!",
"trackName": "ME!",
"artistName": "Brendon Urie",
"albumName": "Lover",
"duration": 185.8,
"instrumental": false,
"plainLyrics": "I promise that you'll never find another like me\nI know that I'm a handful, baby, uh...",
"syncedLyrics": "[00:00.11] I promise that you'll never find another like me\n[00:03.47] I know that I'm a handful, baby, uh..."
},
{
"id": 7807416901227298,
"name": "ME! (feat. Brendon Urie of Panic! At The Disco)",
"trackName": "ME! (feat. Brendon Urie of Panic! At The Disco)",
"artistName": "Taylor Swift",
"albumName": "Lover",
"duration": 185.83,
"instrumental": false,
"plainLyrics": "I promise that you'll never find another like me\nI know that I'm a handful, baby, uh...",
"syncedLyrics": "[00:00.13] I promise that you'll never find another like me\n[00:03.46] I know that I'm a handful, baby, uh..."
}
]

模糊匹配一首歌曲,并直接返回包含 LRC 歌词与纯文本歌词的结果

GET/v1/lrclib/get

必须提供 track_nameartist_name

参数名 类型 必填 说明
track_name string 歌曲名
artist_name string 歌手名
album_name string 专辑名

请求成功时返回 200 状态码及如下结构

type LrcLibGetResponse = LrclibSongItem;
示例响应
{
"id": 269710089745311,
"name": "ME!",
"trackName": "ME!",
"artistName": "Brendon Urie",
"albumName": "Lover",
"duration": 185.8,
"instrumental": false,
"plainLyrics": "I promise that you'll never find another like me\nI know that I'm a handful, baby, uh...",
"syncedLyrics": "[00:00.11] I promise that you'll never find another like me\n[00:03.47] I know that I'm a handful, baby, uh..."
}

通过搜索接口返回的 id 获取完整歌词

GET/v1/lrclib/get/{id}
参数名 类型 必填 说明
id number 从 search 接口获取到的 ID

请求成功时返回 200 状态码及如下定义:

type LrcLibGetByIdResponse = LrclibSongItem;
示例响应
{
"id": 269710089745311,
"name": "ME!",
"trackName": "ME!",
"artistName": "Brendon Urie",
"albumName": "Lover",
"duration": 185.8,
"instrumental": false,
"plainLyrics": "I promise that you'll never find another like me\nI know that I'm a handful, baby, uh...",
"syncedLyrics": "[00:00.11] I promise that you'll never find another like me\n[00:03.47] I know that I'm a handful, baby, uh..."
}

在线测试

发送请求以进行调试