A HTML Pipeline filter for extracting URLs and making them bit.ly links.
Add this line to your application's Gemfile:
gem 'html-pipeline-bitly'
And then execute:
$ bundle
Or install it yourself as:
$ gem install html-pipeline-bitly
To configure this filter to exclude certain hostnames you can set which hosts you want to be excluded from the Bitly shortener:
HTML::Pipeline::BitlyLinkFilter.allowed_hostnames = ['github.com', 'bit.ly']
This pipeline filter also requires Redis as a backend storage, so with that you can just pass in your global instance of your Redis connection like below or instantiate your own:
HTML::Pipeline::BitlyLinkFilter.redis = $redis
By default all links will be prefixed in redis with the bitly
namespace, if you'd like to change this you can just set it like below:
HTML::Pipeline::BitlyLinkFilter.redis_namespace = 'hire'
Happy Pipelining!
- 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