album-cover-url
v2.2.0
Published
Get the URL for an album cover
Downloads
9
Readme
album-cover-url
Get the URL for an album cover from Bandcamp, SoundCloud, or Apple
Setup
In Google Cloud Platform console
- Create a new Project, called something like "album-cover-url apple"
- Find and enable the "Custom Search API" (Enabled APIs & Services)
- Generate an API key (Create Credentials -> API Key), optionally restricting to "Custom Search API" access.
- Repeat x 2, naming projects "album-cover-url bandcamp", "album-cover-url soundcloud" (names don't matter, but just so you know what they are)
Usage
CLI
copy .config.json.example
to .config.json
, fill with Google Cloud Platform API keys
$ node cli.js "Khruangbin" "Mordechai"
Searching for album cover URL for: { artist: 'Khruangbin', album: 'Mordechai' }
{
url: 'https://is5-ssl.mzstatic.com/image/thumb/Music115/v4/94/a7/44/94a74465-1fe9-b897-a1ed-99b2e5b3b497/656605149363.jpg/1500x0w.png',
source: 'apple'
}
Node module
const getAlbumCoverUrl = require("album-cover-url");
getAlbumCoverUrl.API_KEY_CONFIG = {
APPLE_GOOGLE_SEARCH_API_KEY: "YOUR_API_KEY",
BANDCAMP_GOOGLE_SEARCH_API_KEY: "YOUR_API_KEY",
SOUNDCLOUD_GOOGLE_SEARCH_API_KEY: "YOUR_API_KEY",
};
getAlbumCoverUrl({ artist: "Khruangbin", album: "Mordechai" })
.then((url) => {
console.log(url);
process.exit(0);
})
.catch((err) => {
console.error(err);
process.exit(1);
});