Socket
Socket
Sign inDemoInstall

spotify-finder

Package Overview
Dependencies
57
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    spotify-finder

A isomorphic Spotify API client


Version published
Maintainers
2
Created

Readme

Source

spotify-finder

Build Status Coverage Status

A isomorphic Spotify client, that use the Client Credentials authorization flow. It allows to use some Spotify Web API endpoints.

Install

$ npm install spotify-finder

Usage

import Spotify from 'spotify-finder'
const client = new Spotify({
  consumer: {
    key: 'YOUR_CLIENT_ID', // if your not have an app in spotify ignore this options
    secret: 'YOUR_CLIENT_SECRET' // if your not have an app in spotify ignore this options
  }
})

Note: if you do not Provide the client credentials, some features that require authentication will not be available. To create an application in Spotify. click here

Search for all types
const params = {
  q: 'Demi', // required
}
client.search(params)
  .then(data => {
    // do something with data
  })
Search for type specific with limit
const params = {
  q: 'Stone Cold', // required
  type: 'artist', // optional for default 'artist,album,track'
  limit: 5 // optional for default 20
}
client.search(params)
  .then(data => {
    // do something with data
  })
Get a List of New Releases
client.browse({ to: 'new-releases' })
  .then(albums => {
    // do something with album's
  })
client.browse({ to: 'featured-playlists' })
  .then(playlists => {
    // do something with playlist's
  })
Get a List of Categories
client.browse({ to: 'categories' }
  .then(categories => {
    // do something with categories
  })
Get album by id
client.getAlbum('41MnTivkwTO3UUJ8DrqEJJ', { tracks: false })
  .then(album => {
    // do something with album
  })
Get an album's tracks
client.getAlbum('41MnTivkwTO3UUJ8DrqEJJ', { tracks: true })
  .then(tracks => {
    // do something with tracks
  })
Get several albums by id
const ids = ['41MnTivkwTO3UUJ8DrqEJJ', '6UXCm6bOO4gFlDQZV5yL37']
client.getAlbums(ids)
  .then(albums => {
    // do something with albums
  })
Get artist by id
client.getArtist('6S2OmqARrzebs0tKUEyXyp')
  .then(artist => {
    // do something with artist
  })
Get an artist's albums
client.getArtist('6S2OmqARrzebs0tKUEyXyp', { albums: true })
  .then(albums => {
    // do something with albums
  })
Get an artist's top tracks
client.getArtist('6S2OmqARrzebs0tKUEyXyp', { topTracks: true })
  .then(tracks => {
    // do something with tracks
  })
client.getArtist('6S2OmqARrzebs0tKUEyXyp', { relatedArtists: true })
  .then(artists => {
     //do something with artists
  })
Get several artists by id
const ids = ['15deb326635d69d0505434', '934da7155ec15deb32663'],
client.getArtists(ids)
  .then(artists => {
    //do something with artists
  })
Get an track by id
client.getTrack('934da7155ec15deb32663')
  .then(track => {
    //do something with track
  })
Get several tracks by id
const ids = ['15deb326635d69d0505s', 'da7155ec15deb326635d69d']
client.getTracks(ids)
  .then(tracks => {
    //do something with tracks
  })

Keywords

FAQs

Last updated on 20 Sep 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc