@lavaclient/spotify
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

A lavaclient plugin that makes it easy to integrate spotify searching into any project.

  • Official Lavaclient Plugin
  • Supports tracks, playlists, and albums.
  • Handles RateLimiting soon

Installation

Stable
yarn add @lavaclient/spotify # or npm install
Beta
yarn add @lavaclient/spotify@beta # or npm install

Usage

import { Track, load } from "@lavaclient/spotify";
import { Node } from "lavaclient";

load({
    /* information used to authenticate */
    client: {
        id: "your spotify client id",
        secret: "your spotify client secret",
    },
    /* whether you want spotify tracks to resolve their youtube counterpart */
    autoResolveYoutubeTracks: false,
    /* the loaders to use. */
    loaders: [ "track", "album" ]
});

const node = new Node({ ... });

// example: in a command or something.
if (node.spotify.isSpotifyUrl(query)) {
    const item = await node.spotify.load(query)
    if (item instanceof Track) {
        const track = await item.resolveYoutubeTrack();
        await player.playTrack(track)
    }
}
Disclaimer

Leaving the autoResolveYoutubeVideos option on is much slower and could get you banned from YouTube, however IP Rotation will decrease your chances dramatically.


melike2d © 2018 - present

Readme

Keywords

Package Sidebar

Install

npm i @lavaclient/spotify

Weekly Downloads

439

Version

3.1.0

License

Apache-2.0

Unpacked Size

31.9 kB

Total Files

20

Last publish

Collaborators

  • the2dperson