GithubHelp home page GithubHelp logo

feed_parser's Introduction

FeedParser

Rss and Atom feed parser built on top of Nokogiri. Supports custom sanitizers.

Build Status

Build Status

FeedParser gem is tested on Ruby 1.8.7 and 1.9.3.

Install

Add to Gemfile

gem "feed_parser"

Usage

# the most basic use case
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])

# retrieve the feed xml and parse it
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

# you can also pass http options to be used for the connection
# for available options, check out the OpenURI documentation: http://apidock.com/ruby/OpenURI
fp = FeedParser.new(:url => "http://example.com/feed/", :http => {:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE})

If the fetched XML is not a valid RSS or an ATOM feed, a FeedParser::UnknownFeedType is raised in FeedParser#parse.

Running tests

Install dependencies:

$ gem install bundler
$ bundle install

Run rspec tests:

$ bundle exec rake spec

Contributing

Fork, hack, push, create a pull request.

feed_parser's People

Contributors

arttu avatar tsilen avatar lautis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.