Important
This library is feature-complete and only receives bug-fix updates. Feature requests still welcome — please open an issue.
Note
Last.fm cannabilized their own API and broke many applications, including this one. album-art now uses Spotify for image data. The public API is fully backwards-compatible.
- Use anywhere, browser or Node (UMD bundle — browser support)
- Works in React + Next.js, client and server, via cross-fetch
- Promise and callback API
- Fetch images for albums or artists
- Multiple size options (
small·medium·large) - Powered by Spotify's catalog
npm install album-artIn the browser:
<!-- albumArt as a window global -->
<script src="https://unpkg.com/album-art"></script>Also available via JSDelivr.
const albumArt = require("album-art");
albumArt("Rush").then(console.log);
//=> http://path/to/rush.jpgalbumArt("Rush", (error, response) => {
console.log(response);
//=> http://path/to/rush.jpg
});albumArt("Rush", { album: "2112", size: "small" }).then(console.log);
//=> http://path/to/rush_2112_small.jpgTip
Try it live without installing — open in RunKit (here's an example output).
Accepts an artist string to search for. Returns a Promise that resolves to a URL string.
| Argument | Type | Required | Description |
|---|---|---|---|
artist |
string |
✅ | Artist to search for |
options.album |
string |
Album to search for | |
options.size |
"small" | "medium" | "large" |
Requested image size | |
callback |
(err, response) => void |
Optional Node-style callback |
Install globally to use from the shell:
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.jpgPart of a small family of media-data utilities:
- movie-info — Get info, images, and ratings about a movie.
- movie-trailer — Find the trailer for a movie.
- movie-art — Get the poster art for a movie.
- Spotify Web API — image data (subject to the Spotify API Terms).
- The original Last.fm API — RIP, you were the source for the first three major versions of this library.