lyrics-search

TotalClaw 作者 totalclaw

使用 LrcApi 公共 API 按标题和艺术家搜索歌词。当用户要求查找、显示或打印歌曲的歌词时使用。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~hone1983-lyrics-search
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~hone1983-lyrics-search/file -o hone1983-lyrics-search.md
# Lyrics Search

Search lyrics via the LrcApi public API (`api.lrc.cx`).

## API

```
GET https://api.lrc.cx/lyrics?title={title}&artist={artist}
```

- Returns LRC format (with timestamps) as `text/plain`
- `artist` is optional but improves accuracy
- URL-encode Chinese/special characters

## Usage

1. Fetch lyrics via `web_fetch` on the API URL
2. The response is LRC format with `[mm:ss.xxx]` timestamps and metadata lines at the top
3. Strip timestamps and metadata lines (credits, producer info at `[00:00]`–`[00:24]`) for clean display
4. For printing: format as plain text with song title, artist, and credits header

## Example

```
web_fetch("https://api.lrc.cx/lyrics?title=世界赠予我的&artist=王菲")
```

## Notes

- Public API may be slow; set a reasonable timeout
- If no results, try with only `title` (omit `artist`)
- If still no results, try alternate song name spellings

---

## 中文说明

# 歌词搜索

通过 LrcApi 公共 API(`api.lrc.cx`)搜索歌词。

## API

```
GET https://api.lrc.cx/lyrics?title={title}&artist={artist}
```

- 以 `text/plain` 形式返回 LRC 格式(带时间戳)
- `artist` 为可选项,但能提高准确度
- 对中文/特殊字符进行 URL 编码

## 用法

1. 通过对 API URL 执行 `web_fetch` 来获取歌词
2. 响应为 LRC 格式,包含 `[mm:ss.xxx]` 时间戳,以及顶部的元数据行
3. 去除时间戳和元数据行(位于 `[00:00]`–`[00:24]` 的演职员信息、制作人信息),以便清晰显示
4. 如需打印:格式化为纯文本,并附上歌曲标题、艺术家及演职员信息的页眉

## 示例

```
web_fetch("https://api.lrc.cx/lyrics?title=世界赠予我的&artist=王菲")
```

## 注意事项

- 公共 API 可能较慢;请设置合理的超时时间
- 如果没有结果,尝试仅使用 `title`(省略 `artist`)
- 如果仍无结果,尝试使用歌曲名称的其他拼写形式