{"id":13861365,"url":"https://github.com/akashrchandran/spotify-lyrics-api","last_synced_at":"2025-05-15T10:03:28.878Z","repository":{"id":59907358,"uuid":"503075117","full_name":"akashrchandran/spotify-lyrics-api","owner":"akashrchandran","description":"A Rest API for fetching lyrics from Spotify which is powered by Musixmatch. Commandline version is available at akashrchandran/syrics.","archived":false,"fork":false,"pushed_at":"2025-03-22T18:57:16.000Z","size":71,"stargazers_count":450,"open_issues_count":5,"forks_count":33,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-21T18:41:33.832Z","etag":null,"topics":["hacktoberfest","lyrics","musixmatch","spotify","spotify-lyrics","synced-lyrics"],"latest_commit_sha":null,"homepage":"http://github.akashrchandran.in/spotify-lyrics-api/","language":"PHP","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/akashrchandran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","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,"zenodo":null},"funding":{"ko_fi":"akashrchandran","github":"akashrchandran","custom":"https://www.paypal.me/akashrchandran"}},"created_at":"2022-06-13T18:42:56.000Z","updated_at":"2025-04-18T21:33:58.000Z","dependencies_parsed_at":"2023-02-09T20:55:12.924Z","dependency_job_id":"2d46a932-52c7-4d2e-a9c4-6c868e3ab270","html_url":"https://github.com/akashrchandran/spotify-lyrics-api","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":0.09999999999999998,"last_synced_commit":"b47506ee1c9098edc0d075a1ca659f1fa0b01631"},"previous_names":[],"tags_count":5,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashrchandran%2Fspotify-lyrics-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashrchandran%2Fspotify-lyrics-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashrchandran%2Fspotify-lyrics-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashrchandran%2Fspotify-lyrics-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akashrchandran","download_url":"https://codeload.github.com/akashrchandran/spotify-lyrics-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319716,"owners_count":22051072,"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":["hacktoberfest","lyrics","musixmatch","spotify","spotify-lyrics","synced-lyrics"],"created_at":"2024-08-05T06:01:19.582Z","updated_at":"2025-05-15T10:03:23.786Z","avatar_url":"https://github.com/akashrchandran.png","language":"PHP","funding_links":["https://ko-fi.com/akashrchandran","https://github.com/sponsors/akashrchandran","https://www.paypal.me/akashrchandran"],"categories":["PHP"],"sub_categories":[],"readme":"\u003c!--\n Copyright (C) 2022 Akash R Chandran\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU Affero General Public License as\n published by the Free Software Foundation, either version 3 of the\n License, or (at your option) any later version.\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n GNU Affero General Public License for more details.\n You should have received a copy of the GNU Affero General Public License\n along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n--\u003e\n\u003cdiv align=\"center\"\u003e\n \n![spotify-lyrics-api](https://github.com/akashrchandran/spotify-lyrics-api/assets/78685510/12000a6d-ee53-41c4-9c69-98bc2559c5ed)\n\n\u003c/div\u003e\n\n---\n \n\u003cdiv align=\"center\"\u003e\n\nA Rest API for fetching lyrics from Spotify which is powered by Musixmatch. Commandline version is available [akashrchandran/syrics](https://github.com/akashrchandran/syrics).\n \n\u003c/div\u003e\n\n\u003e [!WARNING]\n\u003e This project is probably against Spotify TOS. Use at your own risks.\n \n\u003e [!NOTE]\n\u003e Changed this project into a template repository, deploy your own version. If you need help, don't hesitate to open an issue.\n # Install using Composer\n```\ncomposer require akashrchandran/spotify-lyrics-api\n```\n# Fetching Lyrics\n\n\n\u003e For now it only supports track id or link.\n\n\n## Using GET Requests\n\u003e You have to use query paramters to send data\n\n__Available Parameters:__\n\n| Parameter      | Default value                                               | Type             | Description                                                                                                                                    |\n| -------------- | ----------------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| `trackid `       | None                                             | String           | The trackid from spotify.                                                                                            |\n| `url`       | None                                              | String           | The url of the track from spotify.                                                                                            |\n| `format`        | `\"id3\"`                                                  | String           | The format of lyrics required. It has 2 options either `id3` or `lrc`. |\n\n\u003e You must specify either __trackid__ or __url__, otherwise it will retuen error.\n\n### Examples\n\n__Using trackid__\n\n```\nhttp://localhost:8080/?trackid=5f8eCNwTlr0RJopE9vQ6mB\n```\n__Using url__\n\n```\nhttp://localhost:8080/?url=https://open.spotify.com/track/5f8eCNwTlr0RJopE9vQ6mB?autoplay=true\n```\nresponse:\n\n```json\n{\n    \"error\": false,\n    \"syncType\": \"LINE_SYNCED\",\n    \"lines\": [\n        {\n            \"startTimeMs\": \"960\",\n            \"words\": \"One, two, three, four\",\n            \"syllables\": [],\n            \"endTimeMs\": \"0\"\n        },\n        {\n            \"startTimeMs\": \"4020\",\n            \"words\": \"Ooh-ooh, ooh-ooh-ooh\",\n            \"syllables\": [],\n            \"endTimeMs\": \"0\"\n        }\n    ]\n}\n```\n__Changing format to lrc__\n```\nhttp://localhost:8080/?trackid=5f8eCNwTlr0RJopE9vQ6mB\u0026format=lrc\n```\nresponse:\n\n```json\n{\n    \"error\": false,\n    \"syncType\": \"LINE_SYNCED\",\n    \"lines\": [\n        {\n            \"timeTag\": \"00:00.96\",\n            \"words\": \"One, two, three, four\"\n        },\n        {\n            \"timeTag\": \"00:04.02\",\n            \"words\": \"Ooh-ooh, ooh-ooh-ooh\"\n        }\n    ]\n}\n```\n\n### Responses\n\u003e Different Responses given out by the API, are listed here.\n\nIf any error occurs the value of the error key will be set to `true` else `false`\n```JSON\n\"error\": false //no error occured\n```\nMost 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`.\n```JSON\n\"syncType\": \"LINE_SYNCED\"\n```\n\u003e 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 :/.\n\n__LINE Synced__\n```JSON\n{\n    \"error\": false,\n    \"syncType\": \"LINE_SYNCED\",\n    \"lines\": [\n        {\n            \"timeTag\": \"00:00.96\",\n            \"words\": \"One, two, three, four\"\n        },\n        {\n            \"timeTag\": \"00:04.02\",\n            \"words\": \"Ooh-ooh, ooh-ooh-ooh\"\n        }\n    ]\n}\n```\n__NOT Synced or Unsynced__\n\u003e Note the `timeTags` is set to `00:00.00`.\n```JSON\n{\n    \"error\": false,\n    \"syncType\": \"UNSYNCED\",\n    \"lines\": [\n        {\n            \"timeTag\": \"00:00.00\",\n            \"words\": \"jaane nahin denge tuje\"\n        },\n        {\n            \"timeTag\": \"00:00.00\",\n            \"words\": \"chaahe tujh ko rab bulaa le, hum naa rab se darane waale\"\n        }\n    ]\n}\n```\n### Error Messages\n\n__When trackid and url both are not given__ (400 Bad Request)\n\nerror response:\n```json\n{\n    \"error\": true,\n    \"message\": \"url or trackid parameter is required!\"\n}\n```\n\n__When no lyrics found on spotify for given track__ (404 Not Found)\n\nerror response:\n```json\n{\n    \"error\": true,\n    \"message\": \"lyrics for this track is not available on spotify!\"\n}\n```\n\n# Using as package\n\u003e Install using `composer require akashrchandran/spotify-lyrics-api`.\n\nInclude the package's autoloader file in your PHP code and call class `Spotify()`.\n\n```PHP\n\u003c?php\nrequire('./vendor/autoload.php');\n\n$spotify = new SpotifyLyricsApi\\Spotify(\"SP_DC here\");\n$spotify-\u003echeckTokenExpire();\n$reponse = $spotify -\u003e getLyrics(track_id: \"1418IuVKQPTYqt7QNJ9RXN\");\n?\u003e\n```\n\n\n![image](https://user-images.githubusercontent.com/78685510/236701387-23165a0e-1c94-474d-aea1-41d8b8464f66.png)\n\n\n# Deployment\n\n\u003e Want to host your own version of this API, But first you need SP_DC cookie from spotify\n\n__Finding SP_DC__\n\nYou will find the detailed guide [here](https://github.com/akashrchandran/syrics/wiki/Finding-sp_dc).\n\n__Heroku__\n\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https://github.com/akashrchandran/spotify-lyrics-api)\n\n__Vercel__\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fakashrchandran%2Fspotify-lyrics-api%2Ftree%2Fmain\u0026env=SP_DC\u0026envDescription=Want%20to%20host%20your%20own%20version%20of%20this%20API%2C%20then%20you'll%20first%20need%20SP_DC%20cookie%20from%20spotify.\u0026envLink=https%3A%2F%2Fgithub.com%2Fakashrchandran%2Fsyrics%2Fwiki%2FFinding-sp_dc\u0026project-name=spotify-lyrics-api\u0026repository-name=spotify-lyrics-api\u0026redirect-url=https%3A%2F%2Fgithub.com%2Fakashrchandran%2Fspotify-lyrics-api%23examples)\n\n\n__Run locally__\n\n\u003e use git to clone the repo to your local machine or you can download the latest [zip](https://github.com/akashrchandran/spotify-lyrics-api/archive/refs/heads/main.zip) file and extract it.\n\n*You need to have PHP installed on you machine to run this program.*\n\n__Enter into the folder via terminal__\n```sh\ncd spotify-lyrics-api\n```\n\n__Set SP_DC token as environment variable temprorily__\n```sh\nexport SP_DC=[token here and remove the square brackets]\n```\n\n__Start the server__\n```\nphp -S localhost:8000 api/index.php\n```\nnow open your browser and type `localhost:8080` and you should see the program running.\n# Credits\n\n• [Me](https://akashrchandran.in)\n  -\u003e For everything.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashrchandran%2Fspotify-lyrics-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakashrchandran%2Fspotify-lyrics-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashrchandran%2Fspotify-lyrics-api/lists"}