hardjunior / spotify-lyrics-api

A Rest API for fetching lyrics from Spotify which is powered by Musixmatch. Commandline version is available at akashrchandran/syrics.

Home Page:https://spotify-lyric-api.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spotify Lyrics API

shield made-with-php

A Rest API for fetching lyrics from Spotify which is powered by Musixmatch. Commandline version is available akashrchandran/syrics.

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

https://spotify-lyric-api.herokuapp.com/?trackid=5f8eCNwTlr0RJopE9vQ6mB

Using url

https://spotify-lyric-api.herokuapp.com/?url=https://open.spotify.com/track/5f8eCNwTlr0RJopE9vQ6mB?autoplay=true

response:

{
    "error": false,
    "syncType": "LINE_SYNCED",
    "lines": [
        {
            "startTimeMs": "960",
            "words": "One, two, three, four",
            "syllables": [],
            "endTimeMs": "0"
        },
        {
            "startTimeMs": "4020",
            "words": "Ooh-ooh, ooh-ooh-ooh",
            "syllables": [],
            "endTimeMs": "0"
        }
    ]
}

Changing format to lrc

https://spotify-lyric-api.herokuapp.com/?trackid=5f8eCNwTlr0RJopE9vQ6mB&format=lrc

response:

{
    "error": false,
    "syncType": "LINE_SYNCED",
    "lines": [
        {
            "timeTag": "00:00.96",
            "words": "One, two, three, four"
        },
        {
            "timeTag": "00:04.02",
            "words": "Ooh-ooh, ooh-ooh-ooh"
        }
    ]
}

Error Messages

When trackid and url both are not given (400 Bad Request)

error response:

{
    "error": true,
    "message": "url or trackid parameter is required!"
}

When no lyrics found on spotify for given track (400 Not Found)

error response:

{
    "error": true,
    "message": "lyrics for this track is not available on spotify!"
}

Credits

Me -> For everything.

About

A Rest API for fetching lyrics from Spotify which is powered by Musixmatch. Commandline version is available at akashrchandran/syrics.

https://spotify-lyric-api.herokuapp.com/

License:GNU General Public License v3.0


Languages

Language:PHP 99.2%Language:Procfile 0.8%