spotify-finder
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',
secret: 'YOUR_CLIENT_SECRET'
}
})
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',
}
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
client.browse({ to: 'new-releases' })
.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 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
client.getArtist('6S2OmqARrzebs0tKUEyXyp', { albums: true })
.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 => {
})