
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
spotify-desktop-remote
Advanced tools
Control your Spotify Desktop app with a simple HTTP interface or Socket.io
Control your Spotify Desktop app from a simple HTTP interface or with Socket.IO.
# Play a track:
curl http://localhost:3001/play/spotify:track:0FutrWIUM5Mg3434asiwkp
# Seek to the halfway mark of the song:
curl http://localhost:3001/seek/0.5
# Set the player volume:
curl http://localhost:3001/volume/0.8
# Play a playlist:
curl http://localhost:3001/play/spotify:album:2YJFLMyzzZ2k4mhfPSiOj2
# Pause the player:
curl http://localhost:3001/pause
# Stop the player:
curl http://localhost:3001/stop
// Keep everything in sync:
socket.on('player.change', function (playerStatus) {
console.log('The current player status is', playerStatus);
});
// Play a track:
socket.emit('play', {uri: 'spotify:track:0FutrWIUM5Mg3434asiwkp'});
// Seek to the halfway mark of the song:
socket.emit('seek', 0.5);
// Set the player volume:
socket.emit('volume', 0.8);
// Play a playlist:
socket.emit('play', {uri: 'spotify:album:2YJFLMyzzZ2k4mhfPSiOj2'});
// Pause the player:
socket.emit('pause');
// Stop the player:
socket.emit('stop');
See the API reference for more details.
There are two parts to the app:
src/server.coffee)src/main.coffee and index.html)# OS X/Linux users:
cd ~/Spotify
# Windows users:
# cd ~/My\ Documents/Spotify
git clone https://github.com/namuol/spotify-desktop-remote.git
cd spotify-desktop-remote
# Start the server on port 3001:
npm start
# Or run it on a different port:
# PORT=3002 npm start
# Finally, run spotify and open the app:
spotify -uri spotify:app:spotify-desktop-remote
# NOTE: You can also run the app by entering
# "spotify:app:spotify-desktop-remote" into Spotify's search bar.
# Now you can control the Spotify Desktop app by hitting the server:
curl http://localhost:3001/play/spotify:track:0FutrWIUM5Mg3434asiwkp
curl http://localhost:3001/volume/1
All GET operations and the player.change socket event return a JSON object representing the current status of the player:
{
loading: false,
playing: true,
position: 19450,
duration: 212400,
index: 0,
repeat: false,
shuffle: false,
volume: 0.849988579750061,
context: null,
contexts: [{
index: 0,
descriptor: {
type: "set"
}
}],
track: {
artists: [{
name: "Rick Astley",
uri: "spotify:artist:0gxyHStUsqpMadRV0Di1Qt"
}],
disc: 1,
duration: 212000,
image: "spotify:image:938dfdd57d4fe8a864f6148ffb9676395d012720",
images: [
[
64,
"spotify:image:9b87c26f500947d28838ebb2e33c120f6b9a6b1b"
],
[
300,
"spotify:image:938dfdd57d4fe8a864f6148ffb9676395d012720"
],
[
600,
"spotify:image:d6e92c8891f16c1126c6d58f47da81873a17e993"
]
],
name: "Never Gonna Give You Up",
number: 1,
playable: true,
popularity: 65,
starred: false,
explicit: false,
availability: "premium",
album: {
uri: "spotify:album:3vGtqTr5he9uQfusQWJ0oC"
},
local: false,
advertisement: false,
placeholder: false,
uri: "spotify:track:0FutrWIUM5Mg3434asiwkp"
}
}
In order to use socket.io, include the following in your <head>:
<script type='application/javascript' src="http://localhost:3001/socket.io/socket.io.js"></script>
Then somewhere after that you can connect:
var socket = io.connect();
socket.on('player.change', function (playerStatus) {
console.log('The current player status is', playerStatus);
});
socket.on('player.change', callback(playerStatus))socket only
Subscribe to this event to be notified whenever anything about the player changes.
To poll for the status (with sockets or GET), see sync.
socket.on('player.change', function (playerStatus) {
console.log('The current volume level is', playerStatus.volume)
});
Parameters:
callback(playerStatus)socket only A callback function that accepts a single argument as the player's current status.
/syncsocket.emit('sync', callback(playerStatus))Perform no action; simply used to retrieve the current status of the player.
curl http://localhost:3001/sync
socket.emit('sync', function (playerStatus) {
console.log('The current volume level is', playerStatus.volume);
});
Parameters:
callback(playerStatus)socket only A callback function that accepts a single argument as the player's current status.
/playsocket.emit('play')Play the current track.
curl http://localhost:3001/play
socket.emit('play');
/play/:track_uri/:ms?/:duration?socket.emit('play', {uri[, ms, duration]})Play a specific track with a given URI.
curl http://localhost:3001/play/spotify:track:0FutrWIUM5Mg3434asiwkp
# Play the first 30 seconds:
curl http://localhost:3001/play/spotify:track:0FutrWIUM5Mg3434asiwkp/0/30000
# Play the first 30 seconds starting one minute into the song:
curl http://localhost:3001/play/spotify:track:0FutrWIUM5Mg3434asiwkp/60000/30000
socket.emit('play', {uri: 'spotify:track:0FutrWIUM5Mg3434asiwkp'});
// Play the first 30 seconds:
socket.emit('play', {
uri: 'spotify:track:0FutrWIUM5Mg3434asiwkp',
ms: 0,
duration: 30000
});
// Play the first 30 seconds starting one minute into the song:
socket.emit('play', {
uri: 'spotify:track:0FutrWIUM5Mg3434asiwkp',
ms: 60000,
duration: 30000
});
Parameters:
track_uri/uriA spotify track URI.Example:
spotify:track:0FutrWIUM5Mg3434asiwkp
msoptional Number of milliseconds to begin playing the track at.
durationoptional Number of milliseconds to play the song for before stopping.
/play/:playlist_uri/:index?/:ms?/:duration?socket.emit('play', {uri[, index, ms, duration]})Play a specific album or user playlist with a given URI.
curl http://localhost:3001/play/spotify:album:2YJFLMyzzZ2k4mhfPSiOj2
curl http://localhost:3001/play/spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k
# Start at the third track in the playlist:
curl http://localhost:3001/play/spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k/3
# Start a minute into the third track in the playlist:
curl http://localhost:3001/play/spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k/3/60000
# Start a minute into the third track in the playlist and play the first 30 seconds:
curl http://localhost:3001/play/spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k/3/60000/30000
socket.emit('play', {uri: 'spotify:album:2YJFLMyzzZ2k4mhfPSiOj2'});
socket.emit('play', {uri: 'spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8'});
// Start at the third track in the playlist:
socket.emit('play', {
uri: 'spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k',
index: 3
});
// Start a minute into the third track in the playlist:
socket.emit('play', {
uri: 'spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k',
index: 3,
ms: 60000
});
// Start a minute into the third track in the playlist and play the first 30 seconds:
socket.emit('play', {
uri: 'spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k',
index: 3,
ms: 60000,
duration: 30000
});
Parameters:
playlist_uri/uriA spotify playlist URI (an album or user playlist).Example:
spotify:album:2YJFLMyzzZ2k4mhfPSiOj2Example:
spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k
indexoptional The track number to play (starting at zero).
msoptional Number of milliseconds to begin playing the track at.
durationoptional Number of milliseconds to play the song for before stopping.
/pausesocket.emit('pause')Pause the player.
curl http://localhost:3001/pause
socket.emit('pause');
/stopsocket.emit('stop')Stop the player.
curl http://localhost:3001/stop
socket.emit('pause');
/volume/:volumesocket.emit('volume', volume)Set the player volume level.
curl http://localhost:3001/volume/1
curl http://localhost:3001/volume/0
curl http://localhost:3001/volume/0.5
socket.emit('volume', 1);
socket.emit('volume', 0);
socket.emit('volume', 0.5);
Parameters:
volumeA number representing the volume level, between 0 and 1.
/seek/:amountsocket.emit('seek', amount)Set the playhead's position.
curl http://localhost:3001/seek/0
curl http://localhost:3001/seek/0.5
socket.emit('seek', 0);
socket.emit('seek', 0.5);
Parameters:
amountA number representing the position of the seek bar, between 0 and 1.
MIT
FAQs
Control your Spotify Desktop app with a simple HTTP interface or Socket.io
We found that spotify-desktop-remote demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.