host-image-resolver
v0.1.1
Published
Resolves various image host URLs to image paths
Downloads
4
Readme
#Host Image Resolver
Talks to various image hosting services to resolve a URL into all pictures associated with said URL.
Currently Supported Services
- imgur (auth required for albums)
- deviantArt (including fav.me URLs)
- gfycat
- tumblr (auth required)
- yande.re
Installation
npm install host-image-resolver
Configuration
Some services require authentication tokens. To set these values, you can create a hir-config.js
file in the root of your project.
module.exports = {
IMGUR_CLIENT_SECRET: 'the-secret',
TUMBLER_KEY: 'tumbl-tumbl'
};
How to Use
HIR is simple to use, exposing only one public method:
const hostImageResolver = require('host-image-resolver');
hostImageResolver('http://imgur.com/a/an-album').then((urls) => {
console.log(urls);
// [ 'https://i.imgur.com/image1.jpg', 'https://i.imgur.com/image2.jpg' ]
// urls will always be an array
});