Skip to content
A feed fetching and parsing library
Branch: master
Clone or download
Pull request Compare This branch is 57 commits behind feedjira:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status Code Climate Gitter

Feedjira (formerly Feedzirra) is a Ruby library designed to fetch and parse feeds as quickly as possible.

Getting Started

Feedjira is tested with Ruby version 1.9.3 and 2.x so like any Ruby gem, the first step is to install the gem:

$ gem install feedjira

Or add it to your Gemfile:

gem "feedjira"

Fetching and Parsing

For many users, the fetch_and_parse method is what they use Feedjira for. This method takes a url and returns a Parser object:

url = ""
feed = Feedjira::Feed.fetch_and_parse(url)
# => #<Feedjira::Parser::Atom...>

These feed objects have both the meta data for a feed and an entries collection that contains all the entries that were found:

# => "Feedjira Blog"
# => ""
feed.entries # returns an array of Entry objects
# => [<Feedjira::Feed::Entry ...>, <Feedjira::Feed::Entry ...>, ...]

These entry objects contain the data parsed from the feed XML:

entry = feed.entries.first
# => "Announcing verison 1.0"
# => ""

Just Parsing

The parsing functionality of Feedjira has been exposed so that it can be used in isolation:

xml = Faraday.get(url).body
feed = Feedjira::Feed.parse xml
# => "Announcing verison 1.0"

Adding a feed parsing class

When determining which parser to use for a given XML document, the following list of parser classes is used:

  • Feedjira::Parser::RSSFeedBurner
  • Feedjira::Parser::GoogleDocsAtom
  • Feedjira::Parser::AtomFeedBurner
  • Feedjira::Parser::Atom
  • Feedjira::Parser::ITunesRSS
  • Feedjira::Parser::RSS

You can insert your own parser at the front of this stack by calling add_feed_class, like this:


Now when you fetch_and_parse, MyAwesomeParser will be the first one to get a chance to parse the feed.

If you have the XML and just want to provide a parser class for one parse, you can specify that using parse_with:

Feedjira::Feed.parse_with(MyAwesomeParser, xml)

Adding attributes to all feeds types / all entries types

# Add the generator attribute to all feed types
# => "TypePad"

Adding attributes to only one class

If you want to add attributes for only one class you simply have to declare them in the class

# Add some GeoRss information
class Feedjira::Parser::RSSEntry
  element "georss:elevation", as: :elevation

# Fetch a feed containing GeoRss info and print them
url = ""
Feedjira::Feed.fetch_and_parse(url).entries.each do |entry|
  puts "Elevation: #{entry.elevation}"


Stripping whitespace from XML

Feedjira can be configured to strip all whitespace but defaults to lstrip only:

Feedjira.configure do |config|
  config.strip_whitespace = true

Follow redirect limit

For fetching feeds, the follow redirect limit defaults to 3 but can be set:

Feedjira.configure do |config|
  config.follow_redirect_limit = 5

Request timeout

The request timeout defaults to 30 but can be set:

Feedjira.configure do |config|
  config.request_timeout = 45

User agent

The default user agent is "Feedjira #{Version}" but can be set:

Feedjira.configure do |config|
  config.user_agent = "Awesome Feed Reader"


Feedjira uses faraday to perform requests, so testing Feedjira is really about stubbing out faraday requests.

Projects that use Feedjira

Feedjira is used in some awesome projects around the web - from RSS readers to add-ons and everything in between. Here are some of them:

  • Feedbin: Feedbin bills itself as a fast, simple RSS reader that delivers a great reading experience. It's a paid RSS reader that integrates with mobile apps and it even has a fully featured API!

  • Stringer: Stringer is a self-hosted, anti-social RSS reader. It's an open-source project that's easy to deploy to any host, there's even a one-click button to deploy on Heroku.

  • BlogFeeder: BlogFeeder is a paid Shopify App that makes it easy for you to import any external blog into your Shopify store. It helps improve your store's SEO and keeps your blogs in sync, plus a lot more.

  • Feedbunch: Feedbunch is an open source feed reader built to fill the hole left by Google Reader. It aims to support all features of Google Reader and actually improve on others.

  • The Old Reader: The Old Reader advertises as the ultimate social RSS reader. It's free to start and also has a paid premium version. There's an API and it integrates with many different mobile apps.

  • Solve for All: Solve for All combines search engine and feed parsing while protecting your privacy. It's even extendable by the community!

Note: to get your project on this list, simply send an email with your project's details.

You can’t perform that action at this time.