1.0.1 • Published 4 years ago

spotify-music-helper v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

spotify-music-helper

This npm will help Discord bot devs to add Spotify support to there music commands!

Basic usage(s)

const { getPlaylist } = require("spotify-music-helper")
const query = "https://open.spotify.com/playlist/2Rp8XHU2VeNBhQvbX6IVPW?si=0fc23fd7a816436d"

if(query.startsWith("https://open.spotify.com/playlist")) /*you can do regex if you want*/ {
    const res = await getPlaylist(query)

    for (const info of res.tracks.items) {
        /*
        then you can search it on YouTube the best way to do it is 
        <searchYouTube>(`${info.track.name} - ${info.track.artists[0].name}`)
        */
    }
}

Now tracks

const res = await getTrack("<spotify url>")
console.log(res)

Now albums

const { getAlbum } = require("spotify-music-helper")
const query = "https://open.spotify.com/album/3oIFxDIo2fwuk4lwCmFZCx?si=H-1tB5EQTrCirxGF_VjpuA&dl_branch=1"

if(query.startsWith("https://open.spotify.com/album")) /*you can do regex if you want*/ {
    const res = await getPlaylist(query)

    for (const info of res.tracks.items) {
        /*
        then you can search it on YouTube the best way to do it is 
        <searchYouTube>(`${info.name} - ${info.artists[0].name}`)
        */
    }
}
1.0.1

4 years ago

1.0.0

4 years ago