discogs-image-grabber
v0.0.2
Published
Grabs images from Discogs API
Downloads
4
Readme
Discogs Image Grabber
Grab Discogs images via command line:
$ discogs --token a9c8d34176060890ba50bc300d43ce01 --userAgentURL http://yourwebsite.com --requestURL /releases/561793
The token
is strictly needed, you can get it from the developer settings page of your Discogs account (see Generate new token).
Regarding the user agent, Discogs API states that your application must provide a User-Agent string that identifies itself, so providing the userAgentURL
parameter will result in issuing the request with:
discogs-image-grabber/{version} +http://yourwebsite.com
In order not to write token
and userAgentURL
all over the place, you may place them in your environment variables, either globally or via .env
file, like:
DISCOGS_TOKEN=a9c8d34176060890ba50bc300d43ce01
DISCOGS_USER_AGENT_URL=http://yourwebsite.com
If you want to use it into your scripts:
var DiscogsGrabber = require('discogs-image-grabber')
DiscogsGrabber({
requestURL: '/releases/561793',
token: 'a9c8d34176060890ba50bc300d43ce01',
userAgentURL: 'http://yourwebsite.com'
}).then(function(file){
// file is the absolute path of the saved image
}).catch(function(error){
// too bad
})
Disclaimer
Make a fair use of this, so do not pipe a gazillion request per seconds: Discogs limits them to 20 per minute per IP address, so _.throttle
is your friend.