Welcome to spotify-info.js
spotify-info.js module was written for get track/playlist/album/artist infos by their name, their ID or their URL.
You must get a Spotify Client ID and Spotify Client Secret to use this module!
How i get Spotify Client ID/Secret?
-
Firstly, click here to go to the Spotify Dashboard
-
Then, login to the Dashboard and create an app.
-
Finally copy this app's Client ID and Client Secret
-
Tadaa 🎉🎉. You are ready for use this module.
Usage
const { Spotify } = require("spotify-info.js");
const infos = new Spotify({
clientID: "Your Spotify Client ID",
clientSecret: "Your Spotify Client Secret",
});
const trackInfoByName = await infos.searchTrack("Track Name");
console.log(trackInfoByName);
const playlistInfoByName = await infos.searchPlaylist("Playlist Name");
console.log(playlistInfoByName);
const albumInfoByName = await infos.searchAlbum("Album Name");
console.log(albumInfoByName);
const artistInfoByName = await infos.searchArtist("Artist Name");
console.log(artistInfoByName);
const trackInfoByID = await infos.getTrack("Track ID");
console.log(trackInfoByID);
const playlistInfoByID = await infos.getPlaylist("Playlist ID");
console.log(playlistInfoByID);
const albumInfoByID = await infos.getAlbum("Album ID");
console.log(albumInfoByID);
const artistInfoByID = await infos.getArtist("Artist ID");
console.log(artistInfoByID);
const userInfoByID = await infos.getUser("User ID");
console.log(userInfoByID);
const trackInfoByURL = await infos.getTrackByURL("Track URL");
console.log(trackInfoByURL);
const playlistInfoByURL = await infos.getPlaylistByURL("Playlist URL");
console.log(playlistInfoByURL);
const albumInfoByURL = await infos.getAlbumByURL("Album URL");
console.log(albumInfoByURL);
const userInfoByURL = await infos.getUserByURL("User URL");
console.log(userInfoByURL);
Playing a track/playlist/album with link (for discord.js v12 users
NOTE: You have to get a YouTube API Key to use this methods!
NOTE 2: This methods running with only discord.js and not supporting discord.js v11!
const { Spotify } = require("spotify-info.js");
const infos = new Spotify({
clientID: "Your Spotify Client ID",
clientSecret: "Your Spotify Client Secret",
});
channel.join().then(connection => {
const playTrack = await infos.playTrack("Track URL",{
apiKey: "Your YouTube API Key",
connection
});
});
channel.join().then(connection => {
const playList = await infos.playList("Playlist URL",{
apiKey: "Your YouTube API Key",
connection
});
});
channel.join().then(connection => {
const playAlbum = await infos.playAlbum("Album URL",{
apiKey: "Your YouTube API Key",
connection
});
});
Changelog
1.0.4
1.0.3
- Added playTrack, playList and playAlbum for discord.js v12 users.
1.0.2
1.0.1
- Added getTrackByURL, getPlaylistByURL, getAlbumByURL and getUserByURL.
1.0.0