spotifind
v1.0.1
Published
Cliente para la API de Spotify
Readme
Spotifind
This is a client for the Spotify API that allows searching for artists, albums, tracks, and retrieving information about categories, playlists, and more.
Installation
Before starting, make sure you have Node.js installed. Then, clone the repository and install dependencies:
npm installConfiguration
To use the client, you need to obtain Spotify API credentials from the Spotify Developer Dashboard.
Example configuration:
const Client = require("spotifind");
const spotify = new Client({
consumer: {
key: "YOUR_CLIENT_ID",
secret: "YOUR_CLIENT_SECRET"
}
});Available Methods
fetch(path, params)
Makes an HTTP request to a Spotify endpoint.
path(string): The endpoint path.params(Object, optional): Query parameters.
Example:
spotify.fetch(spotify.endpoints.search, { q: "Coldplay", type: "artist" })
.then(console.log)
.catch(console.error);search(params, callback)
Searches for artists, albums, and tracks on Spotify.
params(Object):q(string, required): Search query.type(string, optional, default"artist,album,track"): Search type.limit(number, optional, default20): Number of results.
callback(Function, optional): Callback function.
Example:
spotify.search({ q: "Daft Punk", type: "artist" })
.then(console.log)
.catch(console.error);getAlbum(id, opts, callback)
Retrieves information about an album or playlist.
id(string): Spotify ID of the album or playlist.opts(Object, optional):tracks(boolean): Iftrue, retrieves only the tracks.
callback(Function, optional): Callback function.
Example:
spotify.getAlbum("3T4tUhGYeRNVUGevb0wThu")
.then(console.log)
.catch(console.error);getAlbums(array_ids, callback)
Retrieves multiple albums by their Spotify IDs.
array_ids(Array): List of album IDs.callback(Function, optional): Callback function.
Example:
spotify.getAlbums(["3T4tUhGYeRNVUGevb0wThu", "1ATL5GLyefJaxhQzSPVrLX"])
.then(console.log)
.catch(console.error);