Ruby RSS Aggregator

DZone 's Guide to

Ruby RSS Aggregator

· ·
Free Resource

RSS feeds offer everyone the ability to aggregate content and centralize the content that matters to you. Several sites offer RSS Aggregation already, so I will demonstrate how you can use Ruby to create your own RSS Aggregator in just a few minutes. With Ruby we can quickly create an RSS Aggregator using the Feed-Normalizer gem.

First, let's install the gem:

gem install feed-normalizer

Now that we have the gem installed, let's put together a simple script that will aggregate Slashdot's RSS Feed:

require 'rubygems'
require 'feed-normalizer'

#Define URL and Parse Feed
feed_url = 'http://rss.slashdot.org/Slashdot/slashdot'
rss = FeedNormalizer::FeedNormalizer.parse open(feed_url)

#Quit if no articles
exit unless rss.entries.length > 0

#Read entries
rss.entries.each do |entry|
title = entry.title
body = entry.content
authors = entry.authors.join(', ') rescue ''
entry_url = entry.urls.first

#Your Logic Here


As you can see, it's quite simple to aggregate an RSS Feed using Ruby and Feed-Normalizer.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}