Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
spotify-mini
Advanced tools
Readme
Simple Spotify client for nodejs exposing useful methods
I was using a basic version of this library on my website for a long time, which led me to transform it into a fully-fledged module.
Make sure to create a refresh_token
with atleast the following permissions enabled:
user-read-currently-playing
user-read-recently-played
user-top-read
:bulb: You can use spotify-rtoken-cli to easily create a
refresh_token
right from your terminal.
# Install with npm
npm install spotify-mini
# Install with yarn
yarn add spotify-mini
# Install with pnpm
pnpm add spotify-mini
import { SpotifyClient } from 'spotify-mini'
const spotify = new SpotifyClient({
clientId: '<YOUR-SPOTIFY-CLIENT-ID>',
clientSecret: '<YOUR-SPOTIFY-CLIENT_SECRET>',
refreshToken: '<YOUR-SPOTIFY-REFRESH-TOKEN>'
})
// Get the currently playing track.
const currentlyPlayingTrack = await spotify.getCurrentTrack()
console.log(currentlyPlayingTrack)
Example output:
{
isPlaying: true,
title: '<track title>',
artist: '<artist name>',
album: '<album name>',
}
Get the currently playing track.
Options | Type | Description |
---|---|---|
fallbackToLastPlayed | boolean | Returns the last played track, if there is no ongoing track atm. (default:true ) |
Get the recently played tracks.
Options | Type | Description |
---|---|---|
limit | number (1 <= n <= 50) | Limit the number of recently played tracks to return. (default: 1 ) |
Get the top tracks of the user.
Options | Type | Description |
---|---|---|
limit | number | Limit the number of recently played tracks to return. (Default: 10 ) |
timeRange | short, medium, long | Over what time range the top tracks should be calculated. (Default: short ) |
refresh_token
right from terminalMIT License © Rocktim Saikia 2024
FAQs
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/rocktimsaikia/spotify-mini/main.yml) ![npm](https://img.shields.io/npm/v/spotify-mini?style=flat-square&color=success&logo=npm)
The npm package spotify-mini receives a total of 3 weekly downloads. As such, spotify-mini popularity was classified as not popular.
We found that spotify-mini demonstrated a healthy version release cadence and project activity because the last version was released less than 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
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.