README
[DEPRECATED] node-spotilocal
Simple wrapper class for Spotify app local webserver.
Install
$ npm install node-spotilocal
$ yarn add node-spotilocal
Usage
// require lib
const Spotilocal = require("node-spotilocal");
// init lib
const spotify = new Spotilocal();
// [optional] get auth tokens from Spotify app or auth process will execute with first request
spotify._auth().then(tokens => {
// ...
}).catch(console.error);
// play track
spotify.play("spotify:track:1qCQTy0fTXerET4x8VHyr9").then(console.log).catch(console.error);
// pause track
spotify.pause().then(console.log).catch(console.error);
// unpause track
spotify.unpause().then(console.log).catch(console.error);
// get app status on particular events (default: ["login", "logout", "play", "pause", "error", "ap"]) or after X seconds (default: 0; 0 = disabled)
spotify.status(["login", "logout", "play", "pause", "error", "ap"], 0).then(console.log).catch(console.error);
// [optional] revoke auth tokens
spotify._revoke();