New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@owngames/spotify

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@owngames/spotify

Spotify Wrapper for: Now Playing, Top Artists, & Top Tracks

latest
Source
npmnpm
Version
0.0.1--canary.51.2893023504.0
Version published
Maintainers
1
Created
Source

@owngames/spotify

Custom API for ygorluizgerald.com/music.

  • nowPlaying: Current Track
  • topArtists: Top Artists
  • topTracks: Top Tracks

🛠️ Usage

Must provide:

const {
  SPOTIFY_CLIENT_ID: clientId,
  SPOTIFY_CLIENT_SECRET: clientSecret,
  SPOTIFY_REFRESH_TOKEN: refreshToken,
} = process.env

const credentials = {
  clientId,
  clientSecret,
  refreshToken,
}

const spotify: ClientProps = new Client({ ...credentials })

This will get the Authorization Token for the Bearer and consistently apply for API calls on your behalf.

📝️ Note: Need to verify w. 2.0.1 release what happens if the token expires 😅️ (before we were getting the token on every request)

Following functions are exposed via spotify.get.*:

  • nowPlaying: Current Track
  • topArtists: Top Artists
  • topTracks: Top Tracks

Example:

spotify.get.topArtists({
  limit,
  offset,
  time_range,
  withImages: true,
})

✨️ Customizations

🧑‍🎤️ artist

For a track we create an artist key that maps across all available artists[artist.name].

🖼️ withImages

If this is passed we dynamically use plaiceholder to add an image key to:

  • nowPlaying: album
  • topArtists: artist
  • topTracks: album

Only call this via an API call.

Keywords

spotify

FAQs

Package last updated on 20 Aug 2022

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