OPDS parser and maker. OPDS(Open Publication Distribution System) is feed which syndicates information about ebooks.

Why "RSS" rather than "Atom"? Because class for Atom bundled with Ruby uses RSS namespace.


Add this line to your application's Gemfile:

gem 'rss-opds'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rss-opds


Parsing OPDS

require 'open-uri'
require 'rss/opds'

opds = RSS::Parser.parse open(uri)
opds.entries.each do |entry|
  price_elem = {|link| link.opds_price}.first
  puts price_elem

If you need performance, install rss-nokogiri gem and write require 'rss/nokogiri' before calling RSS::Parser.parse.

Making OPDS

You may make OPDS feeds as well as normal Atom feeds.

require 'rss/opds'

recent = RSS::Maker.make('atom') do |maker| = '' = 'Example New Catalog' = 'New books in this site' do |link|
    link.href = ''
    link.rel = 'self'
    link.type = RSS::OPDS::TYPES['acquisition']
  end do |link|
    link.href = ''
    link.rel = RSS::OPDS::RELATIONS['start']
    link.type = RSS::OPDS::TYPES['navigation']
  end = '2012-08-14T04:23:00' = 'KITAITI Makoto'

  new_books.each do |book|
    maker.items.new_item do |entry|
      entry.title = book.title
      entry.updated = book.updated
      entry.summary = book.summary =
puts recent # => output OPDS feed

And now, this library provides utility methods which help you make OPDS navigation feeds.

root = RSS::Maker.make('atom') {|maker| = ...

  maker.items.add_relation recent, RSS::OPDS::RELATIONS['new']
  # or just:
  # maker.items.add_new recent
  # these are equivalent to:
  # maker.items.new_item do |item|
  # =
  #   item.title = recent.title
  #   # ...
  # end
puts root # => output XML including entry with 'new' sorting relation


For more examples, see files in examples directory.



  • Add sample script 'examples/build-catalog-from-epub.rb' which build OPDS catalog feed using specified EPUB files
  • Add sample server 'examples/' for Rack
  • Remove Money from dependencies
  • [BUG FIX]Add element component to XPath


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Merge Request

Development Plan

  1. Parser for OPDS catalogs[DONE]
  2. Validation as OPDS
  3. Utility methods like, for example, #buy(gets link element with rel="acquisition/buy"), #price(opds:price element) and so on
  4. Maker for OPDS feeds and entries[DONE]