npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spotify-info.js

v1.0.4

Published

Get Spotify track/playlist/album/artist infos with their names or their ID's

Downloads

86

Readme

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",
});

// Get track infos by track name:
const trackInfoByName = await infos.searchTrack("Track Name");
console.log(trackInfoByName);

// Get playlist infos by playlist name:
const playlistInfoByName = await infos.searchPlaylist("Playlist Name");
console.log(playlistInfoByName);

// Get album infos by album name:
const albumInfoByName = await infos.searchAlbum("Album Name");
console.log(albumInfoByName);

// Get artist infos by artist name:
const artistInfoByName = await infos.searchArtist("Artist Name");
console.log(artistInfoByName);

// Get track infos by track ID:
const trackInfoByID = await infos.getTrack("Track ID");
console.log(trackInfoByID);

// Get playlist infos by playlist ID:
const playlistInfoByID = await infos.getPlaylist("Playlist ID");
console.log(playlistInfoByID);

// Get album infos by album ID:
const albumInfoByID = await infos.getAlbum("Album ID");
console.log(albumInfoByID);

// Get artist infos by artist ID:
const artistInfoByID = await infos.getArtist("Artist ID");
console.log(artistInfoByID);

// Get user infos by user ID:
const userInfoByID = await infos.getUser("User ID");
console.log(userInfoByID);

// Get track infos by track URL:
const trackInfoByURL = await infos.getTrackByURL("Track URL");
console.log(trackInfoByURL);

// Get playlist infos by playlist URL:
const playlistInfoByURL = await infos.getPlaylistByURL("Playlist URL");
console.log(playlistInfoByURL);

// Get album infos by album URL:
const albumInfoByURL = await infos.getAlbumByURL("Album URL");
console.log(albumInfoByURL);

// Get user infos by user URL:
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",
});

// Play track with URL:
channel.join().then(connection => {
const playTrack = await infos.playTrack("Track URL",{
apiKey: "Your YouTube API Key",
connection
});
});

// Play playlist with URL:
channel.join().then(connection => {
const playList = await infos.playList("Playlist URL",{
apiKey: "Your YouTube API Key",
connection
});
});

// Play album with URL:
channel.join().then(connection => {
const playAlbum = await infos.playAlbum("Album URL",{
apiKey: "Your YouTube API Key",
connection
});
});

Changelog

1.0.4

  • Fixed a bug 🐞.

1.0.3

  • Added playTrack, playList and playAlbum for discord.js v12 users.

1.0.2

  • Updated README.md.

1.0.1

  • Added getTrackByURL, getPlaylistByURL, getAlbumByURL and getUserByURL.

1.0.0

  • Module published.