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',
secret: 'YOUR_CLIENT_SECRET'
}
})
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',
}
client.search(params)
.then(data => {
})
Search for type specific with limit
const params = {
q: 'Stone Cold',
type: 'artist',
limit: 5
}
client.search(params)
.then(data => {
})
Get a List of New Releases
const params = {
to: 'new-releases',
limit: 5,
offset: 5
}
client.browse(params)
.then(albums => {
})
Get a List of Featured Playlists
client.browse({ to: 'featured-playlists' })
.then(playlists => {
})
Get a List of Categories
client.browse({ to: 'categories' })
.then(categories => {
})
Get a Category by id
client.getCategory('toptrack')
.then(category => {
})
Get a Category’s Playlists
const params = {
playlists: true,
limit: 5,
offset: 5,
country: 'BR'
}
client.getCategory('toptrack', params)
.then(playlists => {
})
Get album by id
client.getAlbum('41MnTivkwTO3UUJ8DrqEJJ', { tracks: false })
.then(album => {
})
Get an album's tracks
client.getAlbum('41MnTivkwTO3UUJ8DrqEJJ', { tracks: true })
.then(tracks => {
})
Get several albums by id
const ids = ['41MnTivkwTO3UUJ8DrqEJJ', '6UXCm6bOO4gFlDQZV5yL37']
client.getAlbums(ids)
.then(albums => {
})
Get artist by id
client.getArtist('6S2OmqARrzebs0tKUEyXyp')
.then(artist => {
})
Get an artist's albums
const params = {
albums: true,
album_type: 'album,single',
limit: 5,
offset: 5
}
client.getArtist('6S2OmqARrzebs0tKUEyXyp', params)
.then(albums => {
})
Get an artist's top tracks
client.getArtist('6S2OmqARrzebs0tKUEyXyp', { topTracks: true })
.then(tracks => {
})
Get an artist's related artists
client.getArtist('6S2OmqARrzebs0tKUEyXyp', { relatedArtists: true })
.then(artists => {
})
Get several artists by id
const ids = ['15deb326635d69d0505434', '934da7155ec15deb32663'],
client.getArtists(ids)
.then(artists => {
})
Get an track by id
client.getTrack('934da7155ec15deb32663')
.then(track => {
})
Get several tracks by id
const ids = ['15deb326635d69d0505s', 'da7155ec15deb326635d69d']
client.getTracks(ids)
.then(tracks => {
})