spotify-current-track
Simple wrapper class for obtaining current track from Spotify Web API.
Install
$ npm install spotify-current-track
$ yarn add spotify-current-track
Usage
// require libconst SpotifyAPI = ; // init libconst spotify = // [required] fill in your spotify credentials clientId: "<CLIENT_ID>" clientSecret: "<CLIENT_SECRET>" refreshToken: "<REFRESH_TOKEN>" // [optional] override default request timeout, defaults to 0 (no timeout) _timeout: 1000 // milliseconds; // [optional] set marketspotifymarket = "SK"; // get current trackspotifycurrentTrack;
clientId
and clientSecret
can be obtained from your own Spotify App.
refreshToken
can be obtained by Authorization Code Flow with user-read-currently-playing
and/or user-read-playback-state
scope.
Set market
if you want to apply Track Relinking.
Example track
object can be found here.