spotify-current-track
Simple wrapper class for obtaining current track from Spotify Web API.
Install
Via npm [package]:
$ npm install spotify-current-track
Via yarn [package]:
$ yarn add spotify-current-track
Usage
const SpotifyAPI = require("spotify-current-track");
const spotify = new SpotifyAPI({
clientId: "<CLIENT_ID>",
clientSecret: "<CLIENT_SECRET>",
refreshToken: "<REFRESH_TOKEN>",
_timeout: 1000
});
spotify.market = "SK";
spotify.currentTrack.then(track => {
}).catch(console.error);
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.
License
MIT