Project

yarss

0.0
No commit activity in last 3 years
No release in over 3 years
Parse and access RSS/RDF/Atom feeds with a uniform interface.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 0.10
~> 11.1
~> 3.4
~> 0.38
~> 0.11
~> 0.8

Runtime

~> 0.5
 Project Readme

Yarss – Yet Another RSS Feed Normalizer. Build Status Gem Version

Parse and access RSS/RDF/Atom feeds with a uniform interface. Yarss uses MutliXml behind the scenes so you may want to drop in your favourite XML parser.

For MRI users Ox is highly recommended as it is the fastest XML parser I know of. JRuby users should probably use Nokogiri.

Usage

# Parse from a String (raw XML), a Pathname, or an IO:
feed = Yarss.new('<xml string>...')
feed = Yarss.new(Pathname.new('path/to/feed.rss'))
feed = Yarss.new(File.open('path/to/feed.rss', 'rb'))

# Parse using IO-like, needs to respond to #read:
feed = Yarss.from_io(Pathname.new('path/to/feed.rss'))
feed = Yarss.from_io(File.open('path/to/feed.rss', 'rb'))

# Parse from a file path:
feed = Yarss.from_file('path/to/feed.rss')

# Parse from a string:
feed = Yarss.from_string('<xml string>...')

# Access feed attributes:
feed.title       # => "Foo's bars"
feed.link        # => 'http://foo.bar/'
feed.description # => 'Bars everywhere!'

# Access feed items:
feed.items.each do |item|
  item.id         # => 'id'
  item.title      # => 'Hello!'
  item.updated_at # => #<DateTIme ...>
  item.link       # => 'http://foo.bar/1'
  item.author     # => 'Joe'
  item.content    # => '<p>Hi!</p>'
end

Installation

Add this line to your application's Gemfile:

gem 'yarss'

# To increase performance, add one of these gems:
# gem 'ox'       # MRI compatible.
# gem 'nokogiri' # MRI and JRuby compatible.
# gem 'oga'      # MRI, JRuby, Rubinius compatible.

And then execute:

$ bundle

Or install it yourself as:

$ gem install yarss

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ollie/yarss.

License

The gem is available as open source under the terms of the MIT License.