Socket
Book a DemoInstallSign in
Socket

spotifind

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spotifind

Cliente para la API de Spotify

latest
npmnpm
Version
1.0.1
Version published
Weekly downloads
9
125%
Maintainers
1
Weekly downloads
 
Created
Source

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 install

Configuration

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, default 20): 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): If true, 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);

Keywords

spotify

FAQs

Package last updated on 06 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts