TidalPromise
About
node.js TIDAL API, with Promises and playlist manipulation support.
Mantainer Lucas Deters
This is a fork of node.js Tidal API by Lucas Vasconcelos
NOTE: Currently not supporting facebook login.
How to use
Run the following:
npm install tidalpromise
Obtain the Tidal token needed to use this API
As well as a TIDAL username and password, the Tidal API needs an API token
which is unique to your apps. You can get this token by network-sniffing some application that uses TIDAL Playback feature, like Tidal for Windows, Tidal for Android, or CapTune from Sennheiser.
Obtaining a token from TIDAL for Windows
- Install Fiddler and start it.
- In Fiddler, click Tools > Options > Decrypt HTTPS Traffic
- Install TIDAL for Windows and start it
- In Fiddler, look for requests to
api.tidal.com
. Click a request, then on the right, click Inspectors > Headers. Underneath Miscellaneous you'll seeX-Tidal-Token
. This is a TIDAL Token you can use.
Usage
Simple usage searching and querying a track list
var TidalAPI = ; var api = username: 'your-username-here' password: 'your-password-here' token: 'your-token-here' // Could also be 'LOSSLESS' but this only supported on premium subscriptions quality: 'HIGH';
Search
api api api api
Track info
api
Streams
api api
Album Art
console //coverid
Videos
api
FLAC tags
api
Playlist manipulation (example using async/await for clarity)
// get the id of the current userlet user_id = await api;console; // query more information about current userlet user = await api;console; // get all playlists of current userlet result = await api;let current_playlists = resultitems;let playlists_resume = current_playlists;console // search some musicslet track_results = await api;let beatles_tracks = track_resultstracksitems;let beatles_tracks_resume = beatles_tracks;console; // lookup for a specific playlistlet TEST_PLAYLIST = 'Test playlist'let filtered_playlists = current_playlists;let test_playlist = filtered_playlists0 // create a new playlist if necessaryif test_playlist == undefined test_playlist = await api; consoleconsole // add musics to the beginning of the playlistresult = await api;console; // get tracks in the playlistresult = await apilet musics_on_test_playlist = resultitems;let number_of_musics_on_test_playlist = resulttotalNumberOfItems;console; // we added new music to the beginning. so we can delete old musics from the end.let number_of_musics_to_keep = beatles_trackslength;let number_of_musics_to_delete = number_of_musics_on_test_playlist - number_of_musics_to_keep;let positions_to_delete = ...Arraynumber_of_musics_to_delete;result = await api;console; // get tracks in the playlist againresult = await apimusics_on_test_playlist = resultitems;number_of_musics_on_test_playlist = resulttotalNumberOfItems;console; result = await api;console
Troubleshooting
500 error with 'Ooops, an unexpected error occurred'
Your TIDAL token is likely incorrect.