Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lacymorrow/album-art
💽 Fetch cover art for an artist or album: "The Beatles" ➔ http://path/to/beatles.jpg
https://github.com/lacymorrow/album-art
album album-art artists cli javascript nextjs nodejs plugin react
Last synced: 12 days ago
JSON representation
💽 Fetch cover art for an artist or album: "The Beatles" ➔ http://path/to/beatles.jpg
- Host: GitHub
- URL: https://github.com/lacymorrow/album-art
- Owner: lacymorrow
- License: mit
- Created: 2014-04-07T04:30:49.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-02-01T01:14:52.000Z (9 months ago)
- Last Synced: 2024-04-14T00:21:49.732Z (7 months ago)
- Topics: album, album-art, artists, cli, javascript, nextjs, nodejs, plugin, react
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/album-art
- Size: 406 KB
- Stars: 102
- Watchers: 7
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!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 [](https://www.patreon.com/bePatron?u=55065733)
[![npm version](https://badge.fury.io/js/album-art.svg)](https://badge.fury.io/js/album-art) [![Maintainability](https://api.codeclimate.com/v1/badges/c3e8871f2b6009bd97e2/maintainability)](https://codeclimate.com/github/lacymorrow/album-art/maintainability) [![Try movie-art on RunKit](https://badge.runkitcdn.com/album-art.svg)](https://npm.runkit.com/album-art)
> Fetch an album or artist image url: "The Beatles" âž” http://path/to/beatles.jpg
[![album-art](https://github.com/lacymorrow/album-art/raw/master/demo.svg?sanitize=truedemo.svg)]()
#### [Try it on RunKit](https://runkit.com/lacymorrow/album-art) _([Output](https://runkit.io/lacymorrow/album-art/branches/master?search=Ben+Folds&album=Songs+for+Silverman))_
###### NOTE: Last.fm [cannabilized their own API](https://getsatisfaction.com/lastfm/topics/api-announcement-dac8oefw5vrxq) 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](https://caniuse.com/#feat=fetch))_
* Works in React + NextJS client/server (uses [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch))
* Promise and Callback API
* Fetch images for albums or artists
* Multiple size options
* Uses Spotify for image data## Install
Using [NPM](https://npmjs.com):
```bash
$ npm install album-art
```In the browser:
```html
```
(via Unpkg, or via [JSDelivr](https://cdn.jsdelivr.net/npm/album-art/index.min.js))## Usage
```js
const albumArt = require( 'album-art' )await albumArt( 'Rush' ).then( console.log )
//=> http://path/to/rush.jpg
```##### Callback
```js
await albumArt( 'Rush', ( error, response ) => {
console.log( response )//=> http://path/to/rush.jpg
})
```##### Usage with album and size options
```js
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:
```bash
$ 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
* [movie-art](https://github.com/lacymorrow/movie-art)
* [movie-info](https://github.com/lacymorrow/movie-info)
* [movie-trailer](https://github.com/lacymorrow/movie-trailer)## License
This package uses the ~Last.fm~ Spotify API for it's data. You may consult the [Spotify API Terms of Service](https://developer.spotify.com/terms/) for license details.
[MIT](http://opensource.org/licenses/MIT) © [Lacy Morrow](http://lacymorrow.com)