Lamppost
Lamppost provides basic OPML parsing. It provides a convenience class for straightforward parsing of XML and files, but because it causes a parser class to get registered with Feedjira, it also allows you to take fetch and parse files with Feedjira itself.
Basic Usage
Pass in either a File or a String
opml = Lamppost::OPML.new(response.body)You have access to any elements from the OPML's <head>.
title = opml.head.title
name = opml.head.owner_nameAnd the outlines from the <body>
opml.outlines.each do |outline|
text = outline.text
url = outline.xml_url
endFeedjira
Behind the scenes Lampost uses Feedjira parser classes provided by the feedjira-opml gem. That gem registers the OPML parser with Feedjira, so it is available any time Feedjira is used to parse a document.
# Parse against OPML explicitly
Feedjira::Feed.parse_with(Feedjira::Parser::OPML, response.body)# Feedjira will implicitly match the OPML parser when
# it finds an <opml> tag
Feedjira::Feed.parse(response.body)You could also use Feedjira's fetch_and_parse method if you'd like.