ImgurDirect
ImgurDirect takes any imgur url and returns direct urls to images within the link
Installation
Add this line to your application's Gemfile:
gem 'imgur_direct'
And then execute:
$ bundle
Or install it yourself as:
$ gem install imgur_direct
Usage
Make sure to register for Imgur API usage and set IMGUR_CLIENT_ID
in your environment. Then you can use it in your code as per examples below.
Note that it always returns an array. This is to make the api consistent for galleries, albums and direct links.
ENV['IMGUR_CLIENT_ID'] = 'xxxxyyyzzzz'
require 'imgur_direct'
ImgurDirect.new('https://i.imgur.com/neKar7M.gif').urls
ImgurDirect.new('http://imgur.com/gallery/40NpN').urls
ImgurDirect.new('http://imgur.com/a/gYZp4').urls
ImgurDirect.new('http://imgur.com/cp3b6Ra').urls
ImgurDirect.new('http://google.com').urls
ImgurDirect.new('http://google.com').urls(:fallback_plz)
ImgurDirect.new('http://google.com').urls(false)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request