This provides an unofficial API to fetch song lyrics from Spotify. It uses an undocumented internal endpoint, so use it at your own risk.
- Fetches synchronized, color-coded lyrics.
- Caches responses to JSON files to avoid repeated requests.
- Built with FastAPI.
GET /lyrics/{track_id}
track_id(string, required): The Spotify track ID.market(string, optional, default: "from_token"): The market to use for the request.vocal_removal(boolean, optional, default: False): Whether to request lyrics with vocals removed.
curl http://localhost:8000/lyrics/4a8pP5X2lxwU5aprY44jLn{
"lyrics": {
"syncType": "LINE_SYNCED",
"lines": [
{
"startTimeMs": "1000",
"words": "This is an example",
"syllables": []
}
]
}
}-
Clone the repository:
git clone https://github.com/AndresDevvv/spotify-lyrics.git cd spotify-lyrics -
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile:Create a
.envfile in thespotify-lyricsdirectory by copying the.env.examplefile:cp .env.example .env
Then, open the
.envfile and add your Spotify credentials:SPOTIFY_BEARER="your_bearer_token" SPOTIFY_CLIENT_TOKEN="your_client_token" -
Run the server:
python api.py
The server will be running at
http://localhost:8000.