Coder Social home page Coder Social logo

standardgalactic / feed-normalizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aasmith/feed-normalizer

0.0 1.0 0.0 260 KB

Extensible Ruby wrapper for Atom and RSS parsers

Home Page: http://feed-normalizer.rubyforge.org/

License: BSD 3-Clause "New" or "Revised" License

Ruby 100.00%

feed-normalizer's Introduction

== Feed Normalizer

An extensible Ruby wrapper for Atom and RSS parsers.

Feed normalizer wraps various RSS and Atom parsers, and returns a single unified
object graph, regardless of the underlying feed format.

== Download

* gem install feed-normalizer
* http://rubyforge.org/projects/feed-normalizer
* svn co http://feed-normalizer.googlecode.com/svn/trunk

== Usage

    require 'feed-normalizer'
    require 'open-uri'

    feed = FeedNormalizer::FeedNormalizer.parse open('http://www.iht.com/rss/frontpage.xml')

    feed.title # => "International Herald Tribune"
    feed.url # => "http://www.iht.com/pages/index.php"
    feed.entries.first.url # => "http://www.iht.com/articles/2006/10/03/frontpage/web.1003UN.php"

    feed.class # => FeedNormalizer::Feed
    feed.parser # => "RSS::Parser"

Now read an Atom feed, and the same class is returned, and the same terminology applies:

    feed = FeedNormalizer::FeedNormalizer.parse open('http://www.atomenabled.org/atom.xml')

    feed.title # => "AtomEnabled.org"
    feed.url # => "http://www.atomenabled.org/atom.xml"
    feed.entries.first.url # => "http://www.atomenabled.org/2006/09/moving-toward-atom.php"

The feed representation stays the same, even though a different parser was used.

    feed.class # => FeedNormalizer::Feed
    feed.parser # => "SimpleRSS"

== Cleaning / Sanitizing

    feed.title # => "My Feed > Your Feed"
    feed.entries.first.content # => "<p x='y'>Hello</p><object></object></html>"
    feed.clean!

All elements should now be either clean HTML, or HTML escaped strings.

    feed.title # => "My Feed &gt; Your Feed"
    feed.entries.first.content # => "<p>Hello</p>"

== Extending

Implement a parser wrapper by extending the FeedNormalizer::Parser class and overriding
the public methods. Also note the helper methods in the root Parser object to make
mapping of output from the particular parser to the Feed object easier.

See FeedNormalizer::RubyRssParser and FeedNormalizer::SimpleRssParser for examples.

== Authors
* Andrew A. Smith ([email protected])

This library is released under the terms of the BSD License (see the License.txt file for details).

feed-normalizer's People

Contributors

aasmith avatar ginkel avatar fields avatar mikowitz avatar jashmenn avatar

Watchers

 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.