Download the PHP package akashrchandran/spotify-lyrics-api without Composer
On this page you can find all versions of the php package akashrchandran/spotify-lyrics-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download akashrchandran/spotify-lyrics-api
More information about akashrchandran/spotify-lyrics-api
Files in akashrchandran/spotify-lyrics-api
Package spotify-lyrics-api
Short Description A Rest API for fetching lyrics from Spotify which is powered by Musixmatch.
License GPL-3.0-only
Informations about the package spotify-lyrics-api
[!WARNING] This project is probably against Spotify TOS. Use at your own risks.
[!NOTE] Changed this project into a template repository, deploy your own version. If you need help, don't hesitate to open an issue.
Install using Composer
Fetching Lyrics
For now it only supports track id or link.
Using GET Requests
You have to use query paramters to send data
Available Parameters:
Parameter | Default value | Type | Description |
---|---|---|---|
trackid |
None | String | The trackid from spotify. |
url |
None | String | The url of the track from spotify. |
format |
"id3" |
String | The format of lyrics required. It has 2 options either id3 or lrc . |
You must specify either trackid or url, otherwise it will retuen error.
Examples
Using trackid
Using url
response:
Changing format to lrc
response:
Responses
Different Responses given out by the API, are listed here.
If any error occurs the value of the error key will be set to true
else false
Most of the lyrics are time synced or have timetags and some aren't time synced or have timetags. To differentiate between synced and unsynced we have key syncType
.
Musixmatch supports Line synced and Word synced type of timed lyrics. Line Synced is the timetag is given till which the line is sang and the word synced lyrics time specifed when the word comes up in the song. For now Spotify only supports line synced. Maybe they would support word synced in the future :/.
LINE Synced
NOT Synced or Unsynced
Note the
timeTags
is set to00:00.00
.
Error Messages
When trackid and url both are not given (400 Bad Request)
error response:
When no lyrics found on spotify for given track (404 Not Found)
error response:
Using as package
Install using
composer require akashrchandran/spotify-lyrics-api
.
Include the package's autoloader file in your PHP code and call class Spotify()
.
Deployment
Want to host your own version of this API, But first you need SP_DC cookie from spotify
__Finding SP_DC__
You will find the detailed guide here.
Heroku
Vercel
Run locally
use git to clone the repo to your local machine or you can download the latest zip file and extract it.
You need to have PHP installed on you machine to run this program.
Enter into the folder via terminal
__Set SP_DC token as environment variable temprorily__
Start the server
now open your browser and type localhost:8080
and you should see the program running.
Credits
• Me -> For everything.