spotify-manager
v1.2.0
Published
A Node.js Wrapper for Spotify's Web Api easy to use
Downloads
2
Maintainers
Readme
Spotify Manager
A Node.js Wrapper for Spotify's Web Api easy to use
Installing
npm i --save spotify-manager
Features
- Super fast information grabber
- Parser spotify url's
- and more...
Methods
getPlaylist(ID)
manager.getPlaylist("7FTuUqmLy7WPKPPuwRc0uW").then(...)
Return
{
collaborative: false,
description: 'Indie electronica playlist featuring all your favourite indie artists. Indie...',
external_urls: {
spotify: 'https://open.spotify.com/playlist/7FTuUqmLy7WPKPPuwRc0uW'
},
followers: { href: null, total: 16652 },
href: 'https://api.spotify.com/v1/playlists/7FTuUqmLy7WPKPPuwRc0uW',
id: '7FTuUqmLy7WPKPPuwRc0uW',
images: [
{
height: null,
url: 'https://i.scdn.co/image/ab67706c0000bebb033a3fa3bba26f2f72cf6216',
width: null
}
],
name: 'Chill Indie | Gloomy �',
...
getTrack(ID)
manager.getTrack("4TnjEaWOeW0eKTKIEvJyCa").then(...)
Return
album: {
album_type: 'single',
artists: [ [Object] ],
available_markets: [
'AD', 'AE', 'AL', 'AR', 'AT', 'AU', 'BA', 'BE', 'BG',
...
],
external_urls: {
spotify: 'https://open.spotify.com/album/1Czfd5tEby3DbdYNdqzrCa'
},
href: 'https://api.spotify.com/v1/albums/1Czfd5tEby3DbdYNdqzrCa',
id: '1Czfd5tEby3DbdYNdqzrCa',
images: [ [Object], [Object], [Object] ],
name: 'Falling',
release_date: '2018-10-05',
release_date_precision: 'day',
total_tracks: 1,
type: 'album',
uri: 'spotify:album:1Czfd5tEby3DbdYNdqzrCa'
},
artists: [
{
external_urls: [Object],
href: 'https://api.spotify.com/v1/artists/7uaIm6Pw7xplS8Dy06V6pT',
id: '7uaIm6Pw7xplS8Dy06V6pT',
name: 'Trevor Daniel',
type: 'artist',
uri: 'spotify:artist:7uaIm6Pw7xplS8Dy06V6pT'
}
]
getUser(ID)
manager.getUser("6l4ihybie4nb3r2ftpbfjmpfk").then(...)
Return
{
user: {
display_name: 'Zerok',
external_urls: {
spotify: 'https://open.spotify.com/user/6l4ihybie4nb3r2ftpbfjmpfk'
},
followers: { href: null, total: 0 },
href: 'https://api.spotify.com/v1/users/6l4ihybie4nb3r2ftpbfjmpfk',
id: '6l4ihybie4nb3r2ftpbfjmpfk',
images: [ [Object] ],
type: 'user',
uri: 'spotify:user:6l4ihybie4nb3r2ftpbfjmpfk'
},
playlist: [
{
collaborative: false,
description: '',
external_urls: [Object],
followers: [Object],
href: 'https://api.spotify.com/v1/playlists/2y0YPObiiOTNqtOCNPFcp5',
id: '2y0YPObiiOTNqtOCNPFcp5',
images: [Array],
name: '�',
owner: [Object],
primary_color: null,
public: true,
snapshot_id: 'MTEsOGZmNGU5OGVjODU2YjVkNTVkNDVjNzUwZDA1NTRiY2RmOTU0MjI5OA==',
tracks: [Object],
type: 'playlist',
uri: 'spotify:playlist:2y0YPObiiOTNqtOCNPFcp5'
},
... ]
getArtists(ID)
manager.getArtists("0NIPkIjTV8mB795yEIiPYL").then(...)
Return
Artists: {
external_urls: {
spotify: 'https://open.spotify.com/artist/0NIPkIjTV8mB795yEIiPYL'
},
followers: { href: null, total: 1086199 },
genres: [ 'indie pop', 'modern rock', 'rock' ],
href: 'https://api.spotify.com/v1/artists/0NIPkIjTV8mB795yEIiPYL',
id: '0NIPkIjTV8mB795yEIiPYL',
images: [ [Object], [Object], [Object] ],
name: 'Wallows',
popularity: 79,
type: 'artist',
uri: 'spotify:artist:0NIPkIjTV8mB795yEIiPYL'
},
TopTracks: [
{
album: [Object],
artists: [Array],
disc_number: 1,
duration_ms: 178000,
explicit: false,
external_ids: [Object],
external_urls: [Object],
href: 'https://api.spotify.com/v1/tracks/57RA3JGafJm5zRtKJiKPIm',
id: '57RA3JGafJm5zRtKJiKPIm',
is_local: false,
is_playable: true,
name: 'Are You Bored Yet? (feat. Clairo)',
popularity: 86,
preview_url: 'https://p.scdn.co/mp3-preview/d09dcc3195e04df650274c22ef7fff041b5d22f5?cid=20afd8981b124c339678b41c07a14978',
track_number: 4,
type: 'track',
uri: 'spotify:track:57RA3JGafJm5zRtKJiKPIm'
}
... ]
getAlbum(ID)
manager.getAlbum("1AL6GsdQ5SI97EpMGouJmS").then(...)
Return
{
Album: {
album_type: 'single',
artists: [ [Object] ],
available_markets: [
'AD', 'AE', 'AL', 'AR', 'AT', 'AU', 'BA', 'BE', 'BG',
...
],
copyrights: [ [Object], [Object] ],
external_ids: { upc: '192641398551' },
external_urls: {
spotify: 'https://open.spotify.com/album/1AL6GsdQ5SI97EpMGouJmS'
},
genres: [],
href: 'https://api.spotify.com/v1/albums/1AL6GsdQ5SI97EpMGouJmS',
id: '1AL6GsdQ5SI97EpMGouJmS',
images: [ [Object], [Object], [Object] ],
label: 'Illusory Records',
name: 'Tangential Zones',
popularity: 33,
release_date: '2019-12-03',
release_date_precision: 'day',
total_tracks: 5,
tracks: null,
type: 'album',
uri: 'spotify:album:1AL6GsdQ5SI97EpMGouJmS'
},
Tracks: [
{
artists: [Array],
available_markets: [Array],
disc_number: 1,
duration_ms: 204800,
explicit: false,
external_urls: [Object],
href: 'https://api.spotify.com/v1/tracks/4DS5NK2Fyry3O73pQ6pJEX',
id: '4DS5NK2Fyry3O73pQ6pJEX',
is_local: false,
name: 'Immortal Light',
preview_url: 'https://p.scdn.co/mp3-preview/9445c8b2060763974395d77d85811892f9aee454?cid=20afd8981b124c339678b41c07a14978',
track_number: 1,
type: 'track',
uri: 'spotify:track:4DS5NK2Fyry3O73pQ6pJEX'
}
... ]
}
Example
const { SpotifyManager } = require('spotify-manager')
const Manager = new SpotifyManager({ clientId: "...", clientSecret: "..." })
const { Utils: { urlParse } } = require('spotify-manager');
const { id } = urlParse("https://open.spotify.com/playlist/7FTuUqmLy7WPKPPuwRc0uW")
Manager.getPlaylist(id).then(data => console.log(data))
urlParser return
{ type: 'playlist', id: '7FTuUqmLy7WPKPPuwRc0uW' }
getPlaylist() Method return
{
collaborative: false,
description: 'Indie electronica playlist featuring all your favourite indie artists...',
external_urls: {
spotify: 'https://open.spotify.com/playlist/7FTuUqmLy7WPKPPuwRc0uW'
},
followers: { href: null, total: 16652 },
href: 'https://api.spotify.com/v1/playlists/7FTuUqmLy7WPKPPuwRc0uW',
id: '7FTuUqmLy7WPKPPuwRc0uW',
images: [
{
height: null,
url: 'https://i.scdn.co/image/ab67706c0000bebb033a3fa3bba26f2f72cf6216',
width: null
}
],
name: 'Chill Indie | Gloomy �',
owner: {
display_name: 'Strive To Create',
external_urls: {
spotify: 'https://open.spotify.com/user/hal347lgl3ry1vmq4j5qbe3rw'
},
href: 'https://api.spotify.com/v1/users/hal347lgl3ry1vmq4j5qbe3rw',
id: 'hal347lgl3ry1vmq4j5qbe3rw',
type: 'user',
uri: 'spotify:user:hal347lgl3ry1vmq4j5qbe3rw'
},
primary_color: null,
public: true,
snapshot_id: 'MTI0LGMyYTExZjc1YWY5YjI2YzgzMGYxYzdhNzgyMjIxN2M3ZWVkZTNiMDI=',
tracks: {
href: 'https://api.spotify.com/v1/playlists/7FTuUqmLy7WPKPPuwRc0uW/tracks?offset=0&limit=100',
items: [
[Object], [Object], [Object], [Object], [Object], [Object],
... X more items
],
limit: 100,
next: 'https://api.spotify.com/v1/playlists/7FTuUqmLy7WPKPPuwRc0uW/tracks?offset=100&limit=100',
offset: 0,
previous: null,
total: 104
},
type: 'playlist',
uri: 'spotify:playlist:7FTuUqmLy7WPKPPuwRc0uW'
}