npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@silent-killer/killer-spotify-searching

v1.0.5

Published

For Searching Through Spotify Songs!

Downloads

7

Readme

killer-spotify-searching

Install

$ npm install @silent-killer/killer-spotify-searching

Usage

import Spotify from '@silent-killer/killer-spotify-searching'
const client = new Spotify({
  consumer: {
    key: 'YOUR_CLIENT_ID', // from v1.0.0 is required
    secret: 'YOUR_CLIENT_SECRET' // from v1.0.0 is required
  }
})

Note: you have that provide the client credentials because from 29th May 2017 was removed unauthenticated calls to the Spotify Web API more info. 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

const params = {
  to: 'new-releases', // required
  limit: 5, // optional for default 20
  offset: 5 // optional for default 0
}
client.browse(params)
  .then(albums => {
    // do something with album's
  })

Get a List of Featured Playlists

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 a Category by id

client.getCategory('toptrack')
  .then(category => {
    // do something with category
  })

Get a Category’s Playlists

const params = {
  playlists: true, // required
  limit: 5, // optional for default 20
  offset: 5, // optional for default 0
  country: 'BR' // optional for default 'SE'
}
client.getCategory('toptrack', params)
  .then(playlists => {
    // do something with playlists
  })

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

const params = {
  albums: true, // required
  album_type: 'album,single', // optional for default all types
  limit: 5, // optional for default 20
  offset: 5 // optional for default 0
}
client.getArtist('6S2OmqARrzebs0tKUEyXyp', params)
  .then(albums => {
    // do something with albums
  })

Get an artist's top tracks

client.getArtist('6S2OmqARrzebs0tKUEyXyp', { topTracks: true })
  .then(tracks => {
    // do something with tracks
  })

Get an artist's related artists

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
  })