Spotify Search
Overview
•
Installation
•
Usage
Overview
Spotify Search is a package to search for Spotify tracks and playlists without the need for a token, totally transparent to the user and that uses the official Spotify Web API.
Installation
Package install with with npm
npm install spotify-search
Usage
Search
Searching track's
const spotifySearch = require("spotify-search");
(async () => {
const tracks = await spotifySearch.searchTrack("Never Gonna Give You Up");
console.log(tracks[0].id);
console.log(tracks[0].name);
console.log(tracks[0].href);
console.log(tracks[0].artists[0].name);
})();
Searching playlist's
const spotifySearch = require("spotify-search");
(async () => {
const playlists = await spotifySearch.searchPlaylist("Top 50 - Global");
console.log(playlists[0].id);
console.log(playlists[0].name);
console.log(playlists[0].href);
console.log(playlists[0].owner.id);
})();
Get Track info
const spotifySearch = require("spotify-search");
(async () => {
const track = await spotifySearch.getTrackInfoById("4PTG3Z6ehGkBFwjybzWkR8");
console.log(track.id);
console.log(track.name);
console.log(track.href);
console.log(track.artists[0].name);
})();
Get Playlist info
const spotifySearch = require("spotify-search");
(async () => {
const playlist = await spotifySearch.getPlaylist("37i9dQZEVXbMDoHDwVN2tF");
console.log(playlist.id);
console.log(playlist.name);
console.log(playlist.href);
console.log(playlist.owner.id);
})();
Tools
Validate Spotify id
const spotifySearch = require("spotify-search");
console.log(spotifySearch.validateTrackID("4PTG3Z6eh"));
console.log(spotifySearch.validateTrackID(""));
console.log(spotifySearch.validateTrackID("hello"));