[ANN] RSS Parser 0.1.1

K

Kouhei Sutou

Hi,

I released RSS Parser 0.1.1.
http://raa.ruby-lang.org/project/rss/0.1.1

Changes from 0.1.0 are the following:

* RSS::Maker.make(version, modules) ->
RSS::Maker.make(version)

All modules are available without your specification.

* Easy some RSS feeds merging.

#setup_maker was added to RSS::RDF, RSS::RDF::Channel and
so on. It setups maker object which is a block argument
of RSS::Maker.make by receiver's object.

For example, The following script merges RSS
1.0/0.9x/2.0 which are specified as command line
argument and output merged RSS 1.0. You only change the
first argument of RSS::Maker.make, that is "1.0", to
"2.0" if you want to make RSS 2.0.

----
#!/usr/bin/env ruby

require "rss/maker"

feeds = []
encoding = "UTF-8"

ARGV.each do |fname|
rss = nil
f = File.new(fname).read
begin
rss = RSS::parser.parse(f, false)
rescue RSS::Error
end
if rss
begin
rss.output_encoding = encoding
rescue RSS::UnknownConversionMethodError
end
feeds << rss
end
end

rss = RSS::Maker.make("1.0") do |maker|
maker.encoding = encoding
maker.channel.about = "http://example.com/blend.rdf"
maker.channel.title = "blended feeds"
maker.channel.link = "http://example.com/"
maker.channel.description = "blended feeds generated by RSS Parser"

feeds.each do |feed|
feed.items.each do |item|
item.setup_maker(maker)
end
end
maker.items.do_sort = true
# maker.items.max_size = 15
end
puts rss
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top