Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@suchipi/spotify-player

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@suchipi/spotify-player

This is a JavaScript API that drives Spotify in a Chrome window.

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by20%
Maintainers
1
Weekly downloads
 
Created
Source

spotify-player

This is a JavaScript API that drives Spotify in a Chrome window.

You need to have Chrome installed. And it can't run headless, so on Linux, you need an x window server. You can use xvfb if you don't have a graphics card or are in a container.

Usage

You need the following environment variable(s) set:

CHROME_PATH="path to your chrome executable"

Then:

const spotify = require("@suchipi/spotify-player");

// You have to login first
spotify.login(username, password);

// Then you can search for something and play the first result
spotify.searchAndPlay("c418");

// Or, you can play an album or playlist URL directly
spotify.playURL("https://open.spotify.com/playlist/1L3GAiiBL5sBNbDEAMGMEA");

// These functions click the corresponding buttons at the bottom of the screen:
spotify.play();
spotify.pause();
spotify.previous();
spotify.next();

// To start radio for the currently-playing song:
spotify.startRadio();

// To get info about the currently-playing song:
const infoString = await spotify.nowPlayingInfo();

Example REPL

Given a .env file in the current working directory with the following environment variables defined:

SPOTIFY_USERNAME="your spotify username or email"
SPOTIFY_PASSWORD="your spotify password"
CHROME_PATH="path to your chrome executable"

You can run node -r @suchipi/spotify-player/repl -e '' to load a sample song and open a repl where you can test other commands.

License

MIT

FAQs

Package last updated on 11 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc