{"id":13680085,"url":"https://github.com/HisAtri/LrcApi","last_synced_at":"2025-04-29T19:32:40.382Z","repository":{"id":182695722,"uuid":"668944707","full_name":"HisAtri/LrcApi","owner":"HisAtri","description":"A Flask API For StreamMusic.","archived":false,"fork":false,"pushed_at":"2025-04-09T11:29:48.000Z","size":873,"stargazers_count":784,"open_issues_count":2,"forks_count":69,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T12:30:23.148Z","etag":null,"topics":["lyrics","music","navidrome"],"latest_commit_sha":null,"homepage":"https://docs.lrc.cx","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HisAtri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-21T01:31:00.000Z","updated_at":"2025-04-09T11:29:52.000Z","dependencies_parsed_at":"2023-07-21T02:50:39.869Z","dependency_job_id":"e0d7fd16-43c4-4b99-b1bd-05ddf73db19f","html_url":"https://github.com/HisAtri/LrcApi","commit_stats":null,"previous_names":["hisatri/lrcapi"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HisAtri%2FLrcApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HisAtri%2FLrcApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HisAtri%2FLrcApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HisAtri%2FLrcApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HisAtri","download_url":"https://codeload.github.com/HisAtri/LrcApi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251569602,"owners_count":21610587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lyrics","music","navidrome"],"created_at":"2024-08-02T13:01:12.882Z","updated_at":"2025-04-29T19:32:40.375Z","avatar_url":"https://github.com/HisAtri.png","language":"Python","funding_links":[],"categories":["Python","开发工具\u0026框架"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg alt=\"LOGO\" src=\"https://cdn.jsdelivr.net/gh/HisAtri/LrcAPI@main/src/img/LrcAPI-Text-Extra.png\" width=\"313\" height=\"400\" /\u003e\n\u003c/div\u003e\n\n# LrcApi\n\nA Flask API For [StreamMusic](https://github.com/gitbobobo/StreamMusic)\n\n\u003e 欢迎更多的音乐服务接入本API，也欢迎各位前端开发者提出新的API适配需求。\n\n\u003e [JetBrains](https://www.jetbrains.com/) 为本项目提供免费的开源许可证。\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.python.org/downloads/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Python-3.10|3.11|3.12-blue.svg\" alt=\"\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://hub.docker.com/r/hisatri/lrcapi\"\u003e\u003cimg src=\"https://img.shields.io/badge/Docker-Quick%20Start-0077ED.svg\" alt=\"\"\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/HisAtri/LrcApi?color=%23f280bf\" alt=\"\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/commit-activity/m/HisAtri/LrcApi?color=%23bf4215\" alt=\"\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/HisAtri/LrcApi?style=social\" alt=\"\"\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"README.md\"\u003e中文\u003c/a\u003e | \u003ca href=\"README_EN.md\"\u003eEnglish\u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://docs.lrc.cx/\" target=\"_blank\"\u003e查阅文档\u003c/a\u003e\n\u003c/div\u003e\n\n## 功能\n\n支持酷狗/聚合API获取LRC歌词\n\n支持text/json API\n\n支持获取音乐/专辑/艺术家封面\n\n默认监听28883端口，API地址 `http://0.0.0.0:28883/lyrics` ；新版API地址 `http://0.0.0.0:28883/jsonapi` ；封面API地址 `http://0.0.0.0:28883/cover` 。\n\n### 启动参数\n\n| 参数       | 类型  | 默认值   |\n|----------|-----|-------|\n| `--port` | int | 28883 |\n| `--auth` | str |       |\n\n`--auth`参数用于header鉴权，留空则跳过鉴权。验证header中的`Authorization`或`Authentication`字段。如果鉴权不符合，则返回403响应。\n\n也可以使用环境变量`API_AUTH`定义，其优先性低于`--auth`参数，但是更容易在Docker中部署。`-e API_AUTH=自定义一个鉴权key`\n\n## 使用方法\n\n### 公开API\n\n如果无法私有部署，可以先尝试使用公开API。注意：公开API通过酷狗等接口获取歌词，可能响应较慢且并不完全准确。\n\n歌词API地址：`https://api.lrc.cx/lyrics`\n\n封面API地址: `https://api.lrc.cx/cover`\n\n### 二进制文件\n\n上传至运行目录，`./lrcapi --port 8080 --auth 自定义一个鉴权key`\n\n### Python源文件\n\n拉取本项目；或者下载后上传至运行目录，解压tar.gz\n\n安装依赖：`pip install -r requirements.txt`\n\n启动服务：`python3 app.py --port 8080 --auth 自定义一个鉴权key`\n\n### Docker部署方式\n\n```bash\ndocker run -d \\\n    -p 28883:28883 \\\n    -v /home/user/music:/music \\\n    -e API_AUTH=自定义一个鉴权key \\\n    hisatri/lrcapi:latest\n```\n\n或者，请指定一个Tag（推荐）\n\n```bash\ndocker run -d \\\n    -p 28883:28883 \\\n    -v /home/user/music:/music \\\n    -e API_AUTH=自定义一个鉴权key \\\n    hisatri/lrcapi:1.5.2\n```\n\n一个Docker-compose配置如下\n\n```yaml\nservices:\n  lrcapi:\n    image: hisatri/lrcapi:latest\n    container_name: lrcapi\n    ports:\n      - \"28883:28883\"\n    volumes:\n      - /home/user/music:/music\n    environment:\n      - API_AUTH=自定义一个鉴权key\n    restart: always\n```\n\n如果你正在使用Navidrome Docker，请将 `/home/user/music:/music` 中的 `/home/user/music` 修改为你在Navidrome中映射的主机路径；\n\n换句话说，`-v` 参数与Navidrome保持一致即可。\n\n如果你正在使用Navidrome，请将你的音乐文件目录映射到Docker内目录；例如如果你音乐存储的目录是`/www/path/music`，请将启动命令中的映射修改为 `/www/path/music:/www/path/music`\n\n然后访问 `http://0.0.0.0:28883/lyrics` 或新版API `http://0.0.0.0:28883/jsonapi` \n\n图片API地址为 `http://0.0.0.0:28883/cover`\n\n注意：图片返回目前采用反向代理策略，可能存在一定的上下行流量消耗和延迟。\n\n支持使用Nginx或Apache进行反向代理与SSL。\n\n## 音乐元数据修改接口\n\n### 接口详情\n\n- 请求方法：POST\n- 请求路径：/tag\n- 数据类型：application/json\n\n### 支持格式\n\n已测试：\n\n- FLAC(flac)\n- ID3v2(mp3)\n- VorbisComment(ogg)\n\n### 支持标签\n\n- 标题：title\n- 艺术家：artist\n- 专辑：album\n- 歌词：lyrics\n\n### 状态码\n\n- 200 成功\n- 404 未找到文件\n- 421 无权限\n- 422 解析错误\n- 5xx 执行出错\n\n### 简易测试环境\n\n```python\nimport requests\njson_data = {\n    \"path\": \"/path/to/music/file\",\n    \"title\": \"title\",\n    \"artist\": \"artist\",\n    \"album\": \"album\",\n    \"lyrics\": \"lyrics\"\n}\nurl = 'http://127.0.0.1:28883/tag'\nresponse = requests.post(url, json=json_data)\nprint(response.status_code)\nprint(response.text)\n```\n\n## 二次开发说明\n\n本程序基于GPL-3.0开源许可证，您可以自由免费地使用、修改和分发本程序。在二次开发时，请遵守以下要求：\n1. 在您的衍生作品中保留原始版权和许可声明。\n2. 如果您对本程序进行了修改，请清楚地说明您的修改。\n3. 在进行分发时，您需要提供完整的源代码，并以GPL-3.0许可证分发您的衍生作品。\n4. 任何以本程序为基础的商业用途都需要遵守GPL-3.0许可证，并保持免费开放访问。\n5. 除源代码外，本项目的其他部分（包括Logo、服务或标语等）并非由 GPL 3.0 协议开源。\n\n请确保您详细了解GPL-3.0许可证的要求并遵守相关规定。\n\n[![Star History Chart](https://api.star-history.com/svg?repos=HisAtri/LrcApi\u0026type=Date)](https://star-history.com/#HisAtri/LrcApi\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHisAtri%2FLrcApi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHisAtri%2FLrcApi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHisAtri%2FLrcApi/lists"}