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-cover-art-api

v4.1.1

Published

Lightweight Spotify API To Get playlist, cover art, artist, album and track.

Downloads

21

Readme

Spotify-Cover-Art-API

Lightweight Spotify API To Get playlist, cover art, artist, album and track.

Having Null Error? There We Go We Have a fix for it :) You Just Have To Add (nothing, url) like this

const spotify = require('spotify-cover-art-api')

spotify.<type>.cover('<id>', (nothing, url) => console.log(url))
{...}

And We Will Be Updating The Readme.MD Very Soon To A Cleaner And Simple Version.

Install

npm install spotify-cover-art-api --save

Available methods

var spotify = require('Spotify-Cover-Art-API');

// All callbacks are called with:
var callback = function(err, result) {
	// ...
}

// Lookup
// spotify.lookup(uri, callback);
// 
// - returns response from spotifys metadata web api
spotify.lookup('spotify:track:6bc5scNUVa3h76T9nvpGIH', console.log);
spotify.lookup('spotify:artist:7ae4vgLLhir2MCjyhgbGOQ', console.log);
spotify.lookup('spotify:album:5NCz8TTIiax2h1XTnImAQ2', console.log);
spotify.lookup('spotify:user:syknyk:playlist:0Idyatn0m08Y48tiOovNd9', console.log);

// Lookup alternative:
// spotify.<type>(id, callback);
// spotify.playlist(user, id, callback);
spotify.track('6bc5scNUVa3h76T9nvpGIH', console.log);
spotify.artist('7ae4vgLLhir2MCjyhgbGOQ', console.log);
spotify.album('5NCz8TTIiax2h1XTnImAQ2', console.log);
spotify.playlist('syknyk', '0Idyatn0m08Y48tiOovNd9', console.log);

// Cover:
// spotify.cover(uri, [size,] callback);
// 
// - returns url to cover
// - available sizes: 60, 85, 120, 300, 640, 'cover'.
//     defaults to 'cover', which is 300x300, with a spotify logo in lower right corner.
// - sizes are also available in `spotify.coverSize`.
spotify.cover('spotify:track:6bc5scNUVa3h76T9nvpGIH', console.log);
spotify.cover('spotify:artist:7ae4vgLLhir2MCjyhgbGOQ', console.log);
spotify.cover('spotify:album:5NCz8TTIiax2h1XTnImAQ2', console.log);
spotify.cover('spotify:user:syknyk:playlist:0Idyatn0m08Y48tiOovNd9', console.log);

// Size examples:
spotify.cover('spotify:track:6bc5scNUVa3h76T9nvpGIH', spotify.coverSize.SMALL, console.log);
spotify.cover('spotify:artist:7ae4vgLLhir2MCjyhgbGOQ', spotify.coverSize.NORMAL, console.log);
spotify.cover('spotify:album:5NCz8TTIiax2h1XTnImAQ2', spotify.coverSize.LARGE, console.log);
spotify.cover('spotify:user:syknyk:playlist:0Idyatn0m08Y48tiOovNd9', 120, console.log);

// Cover alternative:
// spotify.<type>.cover(id, [size,] callback)
// spotify.playlist.cover(user, id, [size,] callback);
spotify.track.cover('6bc5scNUVa3h76T9nvpGIH', console.log);
spotify.artist.cover('7ae4vgLLhir2MCjyhgbGOQ', console.log);
spotify.album.cover('5NCz8TTIiax2h1XTnImAQ2', console.log);
spotify.playlist.cover('syknyk', '0Idyatn0m08Y48tiOovNd9', console.log);

// Flatten
// spotify.flatten(id, callback);
// 
// - returns array of tracks from any uri or array of uris.
spotify.flatten('spotify:track:6bc5scNUVa3h76T9nvpGIH', console.log);
spotify.flatten('spotify:artist:7ae4vgLLhir2MCjyhgbGOQ', console.log);
spotify.flatten('spotify:album:5NCz8TTIiax2h1XTnImAQ2', console.log);
spotify.flatten('spotify:user:syknyk:playlist:0Idyatn0m08Y48tiOovNd9', console.log);

// Flatten alternative:
// spotify.<type>.flatten(id, callback);
// spotify.playlist.flatten(user, id, callback);
spotify.track.flatten('6bc5scNUVa3h76T9nvpGIH', console.log);
spotify.artist.flatten('7ae4vgLLhir2MCjyhgbGOQ', console.log);
spotify.album.flatten('5NCz8TTIiax2h1XTnImAQ2', console.log);
spotify.playlist.flatten('syknyk', '0Idyatn0m08Y48tiOovNd9', console.log);

// Flatten list of any URIs:
// spotify.flatten(uris, callback);
var uris = [
	'spotify:album:5NCz8TTIiax2h1XTnImAQ2',
	'spotify:track:3gGhcHH075qI9CPSXKnxy1',
	'spotify:artist:5RBdF1pJSLF3ugc2Y2PoB8',
	'spotify:user:syknyk:playlist:0Idyatn0m08Y48tiOovNd9'
];
spotify.flatten(uris, console.log);

Flatten does not guarantee a list of unique tracks. E.g.: Using .flatten on an artist will return a lot of duplicates, because most albums are released in many different territories (countries) by different labels, and each album have their own listing of tracks.