Skip to content

πŸ’½ Fetch cover art for an artist or album: "The Beatles" βž” http://path/to/beatles.jpg

License

Notifications You must be signed in to change notification settings

lacymorrow/album-art

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

91 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Important

This library is considered feature-complete and will only receive updates for bug fixes. You may still create an issue if you have a feature request.

album-art

npm version Maintainability Try movie-art on RunKit

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

album-art

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)
  • Works in React + NextJS client/server (uses isomorphic-fetch)
  • Promise and Callback API
  • Fetch images for albums or artists
  • Multiple size options
  • Uses Spotify for image data

Install

Using NPM:

$ npm install 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' )

await albumArt( 'Rush' ).then( console.log )
//=> http://path/to/rush.jpg
Callback
await albumArt( 'Rush', ( error, response ) => {
   console.log( response )

   //=> http://path/to/rush.jpg
})
Usage with album and size options
await 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