A Node.js module for using the Spotify Metadata Search API. Detailed information about the responses and their structure can be found in the Spotify documentation.
Install it
npm install spotify-metadata-search
Require it
var SpotifySearch = require( 'spotify-metadata-search' );
Search Tracks
var search = SpotifySearch();
var searchText = "whatever";
var optionPageNumber = 2;
search.track( searchText, optionPageNumber, function ( err, data ) {
if ( err ) {
}
} );
Search Albums
var search = SpotifySearch();
var searchText = "whatever";
var optionPageNumber = 2;
search.album( searchText, optionPageNumber, function ( err, data ) {
if ( err ) {
}
} );
Search Artists
var search = SpotifySearch();
var searchText = "whatever";
var optionPageNumber = 2;
search.artist( searchText, optionPageNumber, function ( err, data ) {
if ( err ) {
}
} );
Lookup By URI
var search = SpotifySearch();
var spotifyURI = "spotify:track:1hP6wr5qYhXy5Am2tvndrZ";
search.lookup( spotifyURI, null, function ( err, data ) {
if ( err ) {
}
} );
The second parameter for lookup
can be an array of words that are passed as extras to Spotify. These only apply if you pass in an artist or and album URI. For more information about extras check out the Spotify Metadata API documentation.