Rss and Atom feed parser built on top of Nokogiri. Supports custom sanitizers.
Add to Gemfile
gem "feed_parser"
fp = FeedParser.new(:url => "http://example.com/feed/")
# with sanitizer
fp = FeedParser.new(:url => "http://example.com/feed/", :sanitizer => MyBestestSanitizer.new)
# sanitizing custom field set
fp = FeedParser.new(:url => "http://example.com/feed/", :sanitizer => MyBestestSanitizer.new, :fields_to_sanitize => [:title, :content])
# parse the feed
feed = fp.parse
# using parsed feed in your code
feed.as_json
# => {:title => "Feed title", :url => "http://example.com/feed/", :items => [{:guid => , :title => , :author => ...}]}
feed.items.each do |feed_item|
pp feed_item
end
Install dependencies by running bundle install
.
Run rspec tests:
$ bundle exec rspec
Fork, hack, push, create a pull request.