node-spotilocaldeprecated

[DEPRECATED] Simple wrapper class for Spotify local webserver.

Usage no npm install needed!

<script type="module">
  import nodeSpotilocal from 'https://cdn.skypack.dev/node-spotilocal';
</script>

README

[DEPRECATED] node-spotilocal

npm npm npm paypal

Simple wrapper class for Spotify app local webserver.


Install

Via npm [package]:

$ npm install node-spotilocal

Via yarn [package]:

$ 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();

License

MIT