1.2.2 • Published 5 years ago

spotify-current-track v1.2.2

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

spotify-current-track

npm npm npm paypal

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

// require lib
const SpotifyAPI = require("spotify-current-track");

// init lib
const spotify = new SpotifyAPI({
	// [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 market
spotify.market = "SK";

// get current track
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

1.2.2

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago