API to retrieve play counts of all tracks in a Spotify album.
API to retrieve play counts of all tracks in a Spotify album.
ARCHIVED in favor of sp-playcount-librespot. Please use that instead.
Web server API to retrieve play count of all tracks in a Spotify album.
NOTE: Much of how this API works is mainly based on my needs and configuration (though, there is a config file included to make certain changes).
Overall, this hasn't been tested thoroughly and it is very possible that you may need to modify the script in order to fit your needs. Documentation may also be inaccurate or missing information. Submit an issue if you run into any problems.
npm installconfig.json in project directory is correct. (see section below for what each configuration option means)config.json.%appdata%\Spotify\Apps\zlink.spa (full path: C:\Users\\AppData\Roaming\Spotify\Apps\zlink.spa)/Applications/Spotify.app/Contents/Resources/Apps/zlink.spa/opt/spotify/Apps/zlink.spa. (In the Spotify install directory, it's always located at Apps/zlink.spa)node spotify_zlink.jszlink.spa from (it is recommended to make a backup of the old zlink.spa file in case something goes wrong)spotify --ignore-certificate-errors --allow-running-insecure-contentnode index.jsThe server can be configured in the config.json file.
| Option | Description | Data type |
|---|---|---|
| port | Port on which the web and WebSocket server binds to (TODO: make these separate variables, as this can cause problems and security issues) | Integer |
| useSecure | If true, enables https:// and wss:// | Boolean |
| cert | Location of https certificate file | String |
| key | Location of https private key file | String |
| chain | Location of https chain file | String |
| endpoint | Endpoint at which the user can send HTTP GET requests to the API | String |
| ipAddress | IP Address (preferably a LAN address) at which the Spotify client connects to. This is mainly useful if the web server and the Spotify client are on two different machines. | String |
Simply make a GET request to the endpoint with the query string "albumid" set to the ID of a Spotify album (ex. if the URL is https://open.spotify.com/album/30X5rD2J07BzYmd3CKzZTa or spotify:album:30X5rD2J07BzYmd3CKzZTa, the string is 30X5rD2J07BzYmd3CKzZTa)
Curl example: (endpoint is /api/albumPlayCount)
$ curl https://example.com/api/albumPlayCount?albumid=30X5rD2J07BzYmd3CKzZTa
{"success":true,"data":[{"name":"All My Friends","playcount":1608305,"disc":1,"number":1,"uri":"spotify:track:7sGTH1fber0bhncNMfNxmt"}]}I am currently hosting this API to the public: https://t4ils.dev:4433/api/beta/albumPlayCount
If the public API is not working correctly, please report it here.
Unfortunately, due to an overwhelming amount of requests and lack of proper hardware to keep the API up, I have to shut down the public API indefinitely.
No open issues yet, or sync has not completed.