https://github.com/projectweekend/node-spotify-search
A Node.js module for using the Spotify Metadata Search API
https://github.com/projectweekend/node-spotify-search
Last synced: 4 months ago
JSON representation
A Node.js module for using the Spotify Metadata Search API
- Host: GitHub
- URL: https://github.com/projectweekend/node-spotify-search
- Owner: projectweekend
- License: mit
- Created: 2014-04-08T16:03:57.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-27T21:00:03.000Z (about 12 years ago)
- Last Synced: 2025-10-06T15:46:56.379Z (9 months ago)
- Language: JavaScript
- Size: 180 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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](https://developer.spotify.com/technologies/web-api/).
### Install it
~~~javascript
npm install spotify-metadata-search
~~~
### Require it
~~~javascript
var SpotifySearch = require( 'spotify-metadata-search' );
~~~
### Search Tracks
~~~javascript
var search = SpotifySearch();
// This is the string you want to search for
var searchText = "whatever";
// Use this to page through the Spotify response
var optionPageNumber = 2;
search.track( searchText, optionPageNumber, function ( err, data ) {
if ( err ) {
// handle error
}
// 'data' contains a complete Spotify Track search JSON response
} );
~~~
### Search Albums
~~~javascript
var search = SpotifySearch();
// This is the string you want to search for
var searchText = "whatever";
// Use this to page through the Spotify response
var optionPageNumber = 2;
search.album( searchText, optionPageNumber, function ( err, data ) {
if ( err ) {
// handle error
}
// 'data' contains a complete Spotify Track search JSON response
} );
~~~
### Search Artists
~~~javascript
var search = SpotifySearch();
// This is the string you want to search for
var searchText = "whatever";
// Use this to page through the Spotify response
var optionPageNumber = 2;
search.artist( searchText, optionPageNumber, function ( err, data ) {
if ( err ) {
// handle error
}
// 'data' contains a complete Spotify Track search JSON response
} );
~~~
### Lookup By URI
~~~javascript
var search = SpotifySearch();
var spotifyURI = "spotify:track:1hP6wr5qYhXy5Am2tvndrZ";
search.lookup( spotifyURI, null, function ( err, data ) {
if ( err ) {
// handle error
}
// 'data' contains a complete Spotify lookup JSON response
} );
~~~
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](https://developer.spotify.com/technologies/web-api/lookup/).