Get unlimited public & private packages + team-based management with npm Teams.Learn more »

album-art

2.0.2 • Public • Published

album-art

npm version Build Status Maintainability Try movie-art on RunKit

Fetch an album or artist image url: "The Beatles" ➔ http://path/to/beatles.jpg

album-art

Try it on RunKit (Output)

NOTE: Last.fm cannabilized their own API and broke many applications, including this one. This library now uses Spotify for image data. The usage for album-art has changed slightly but is fully backwards-compatible. Please report any errors.

Features

  • Use anywhere, browser or Node - UMD (Browser Support)
  • Promise and Callback API
  • Fetch images for albums or artists
  • Multiple size options
  • Uses Spotify for image data

Install

Using NPM:

$ npm install -g album-art

In the browser:

<!-- albumArt window global -->
<script type="text/javascript" src="https://unpkg.com/album-art"></script>

(via Unpkg, or via JSDelivr)

Usage

const albumArt = require( 'album-art' )
 
albumArt( 'Rush' ).then( console.log )
//=> http://path/to/rush.jpg
Callback
albumArt( 'Rush', ( error, response ) => {
   console.log( response )
 
   //=> http://path/to/rush.jpg
})
Usage with album and size options
albumArt( 'Rush', {album: '2112', size: 'small'} )
  .then( console.log )
 
//=> http://path/to/rush_2112_small.jpg

API

albumArt(artist [, options] [, callback])

Accepts an artist string to search for. Returns a Promise which resolves to a string URL.

artist

Required
Type: string

Artist to search for.

callback(error, response)

Function to be called on complete or on error.

Options

A JavaScript object with the following properties:

album

Type: string

Album to search for.

size

Type: string

Requested image size. possible values: small, medium, large

CLI Usage

You can also run as a CLI app by installing it globally:

$ npm install --global album-art
 
$ album-art --help
 
Usage
  $ album-art artist [album] [size]
 
Example
  $ album-art 'The Beatles' --album 'Abbey Road' --size 'large'
  http://path/to/beatles/abbey_road_large.jpg

Related

License

This package uses the ~Last.fm~ Spotify API for it's data. You may consult the Spotify API Terms of Service for license details.

MIT © Lacy Morrow

Install

npm i album-art

DownloadsWeekly Downloads

68

Version

2.0.2

License

MIT

Unpacked Size

9.79 kB

Total Files

5

Last publish

Collaborators

  • avatar