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.
Fetch an album or artist image url: "The Beatles" âž” http://path/to/beatles.jpg
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.
- 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
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)
const albumArt = require( 'album-art' )
await albumArt( 'Rush' ).then( console.log )
//=> http://path/to/rush.jpg
await albumArt( 'Rush', ( error, response ) => {
console.log( response )
//=> http://path/to/rush.jpg
})
await albumArt( 'Rush', {album: '2112', size: 'small'} )
.then( console.log )
//=> http://path/to/rush_2112_small.jpg
Accepts an artist string to search for. Returns a Promise which resolves to a string URL.
Required
Type: string
Artist to search for.
Function to be called on complete or on error.
A JavaScript object with the following properties:
Type: string
Album to search for.
Type: string
Requested image size.
possible values: small
, medium
, large
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
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