Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Feedzirra – A New Ruby Feed Library “Built for Speed”

By Peter Cooper / February 4, 2009

feedzirra.gif Feedzirra is an all-new Ruby feed parsing (it's not a generator) library by Paul Dix. The choice of feed parsing libraries in Ruby has been reasonably limited so far, so Feedzirra is a most welcome addition to the Ruby ecosystem. Its focus is on pure speed - it uses Nokogiri (an ultra fast Ruby XML parser that depends on libxml) and curb (bindings for libcurl - to do the HTTP work) so compilation is required. Feedzirra was designed to be used to fetch thousands of feeds, process updates quickly, save on bandwidth (with conditional GETs, etc) and be dead simple to use.

Paul is also interested in flexibility:

A second design consideration was that I wanted the library to be extensible and customizable. This means that you can add custom parsers to Feedzirra to handle different feed types (like microformats, for example). What this also means is that if you find a bug in the parsing on a specific feed, you can write a parser (should take less than 20 lines of code) and use it with Feedzirra while you wait for me or a contributor to get the bug fix in. Feedzirra also allows you to define callback behavior after success or failure of fetching a feed.

Paul has put together a compelling code example that shows off several of Feedzirra's features - including basic fetching and parsing, multiple feed fetching, feed update fetching, and callbacks. To run it, just install Feedzirra:

gem sources -a http://gems.github.com
sudo gem install pauldix-feedzirra

See Paul's announcement post for more, along with comments regarding problems during installation (one key problem I had on OS X Leopard with native Ruby is that curb doesn't install properly - to resolve it git clone git://github.com/taf2/curb.git then run rake gem in the curb directory, then sudo gem install pkg/curb-0.2.4.0.gem - it's not a MacPorts only issue as Paul seems to indicate).

Comments

  1. Nazar says:

    Congratulations and well done on releasing a much needed library.

Other Posts to Enjoy

Twitter Mentions