A Flask API For StreamMusic
Supports using KuGou API and Multi API to get lyrics.
Supports text/json API
Supports obtaining music/album/artist covers
Default listening on port 28883, with API addresses as follows: API http://0.0.0.0:28883/lyrics ;New version API http://0.0.0.0:28883/jsonapi ;Cover API http://0.0.0.0:28883/cover 。
| Parameter | Type | Default Value |
|---|---|---|
--port |
int | 28883 |
--auth |
str |
The --auth parameter is used for header authentication. Leave it blank to skip authentication. It validates the Authorization or Authentication field in the header. If the authentication fails, a 403 response is returned.
Alternatively, you can define the authentication key using the environment variable API_AUTH. Its priority is lower than the --auth parameter but is more convenient for deployment in Docker. Use -e API_AUTH=custom_authentication_key.
If private deployment is not possible, you can try using the public API first. Note: The public API obtains lyrics through interfaces such as Kugou, and the response may be slow and not completely accurate.
Lyrics API: https://api.lrc.cx/lyrics
CoverAPI: https://api.lrc.cx/cover
Upload to the running directory. ./lrcapi --port 8080 --auth {your_privat_key}
Pull this project; or download it and upload it to the running directory, and unzip tar.gz file.
Install requirements: pip install -r requirements.txt
Start the service: python3 app.py --port 8080 --auth 自定义一个鉴权key
docker run -d -p 28883:28883 -v /home/user/music:/music hisatri/lrcapi:latestAlternatively, you can specify a Tag (recommended)
docker run -d -p 28883:28883 -v /home/user/music:/music hisatri/lrcapi:alpine-py1.5.2If you are using Navidrome Docker, please modify /home/user/music:/music by replacing /home/user/music with the host path you have mapped in Navidrome;
In other words, keep the -v parameter consistent with the path mapped in Navidrome.
If you are using Navidrome without Docker, map your music directory to the corresponding Docker directory. For example, if your music is stored in /www/path/music, modify the mapping in the startup command to /www/path/music:/www/path/music.
Then, access http://0.0.0.0:28883/lyrics or the new version API http://0.0.0.0:28883/jsonapi.
The image API address is http://0.0.0.0:28883/cover.
Note: Image retrieval currently employs a reverse proxy strategy, which may result in some upstream and downstream traffic consumption and latency.
You can reverse proxy or SSL encryption through Nginx or Apache.
- Request Method: POST
- Request Path: /tag
- Data Type: application/json
Tested Formats:
- FLAC (flac)
- ID3v2 (mp3)
- VorbisComment (ogg)
- Title: title
- Artist: artist
- Album: album
- Lyrics: lyrics
- 200 Success
- 404 File Not Found
- 421 Unauthorized
- 422 Parsing Error
- 5xx Execution Error
import requests
json_data = {
"path": "/path/to/music/file",
"title": "title",
"artist": "artist",
"album": "album",
"lyrics": "lyrics"
}
url = 'http://127.0.0.1:28883/tag'
response = requests.post(url, json=json_data)
print(response.status_code)
print(response.text)This program is based on the GPL-3.0 open-source license, and you are free to use, modify, and distribute it at no cost. When engaging in secondary development, please adhere to the following requirements:
- Retain the original copyright and license statements in your derivative works.
- Clearly document any modifications you make to this program.
- When distributing, provide the complete source code and distribute your derivative works under the GPL-3.0 license.
- Any commercial use based on this program must comply with the GPL-3.0 license and maintain free and open access.
- Components of this project other than the source code (including logos, services, or slogans) are not open-sourced under the GPL 3.0 license.
Please ensure that you thoroughly understand the requirements of the GPL-3.0 license and comply with relevant provisions.

