summaryrefslogtreecommitdiff
path: root/sample/rss/rss_recent.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-21 12:19:43 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-21 12:19:43 +0000
commit57a639494a2a002f496a945979e2bf499b0d9fdb (patch)
tree53fadfc1666459e1286735a37171539883d66d70 /sample/rss/rss_recent.rb
parent754b1fac44487454cc25a14443615c0fba3da6ad (diff)
* lib/rss.rb, lib/rss/, test/rss/, sample/rss/: merged from trunk.
- 0.1.6 -> 2.0.0. - fixed image module URI. Thanks to Dmitry Borodaenko. - supported Atom. - supported ITunes module. - supported Slash module. * NEWS: added an entry for RSS Parser. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/rss/rss_recent.rb')
-rwxr-xr-x[-rw-r--r--]sample/rss/rss_recent.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/sample/rss/rss_recent.rb b/sample/rss/rss_recent.rb
index 7821df5c7b..38b57c37fa 100644..100755
--- a/sample/rss/rss_recent.rb
+++ b/sample/rss/rss_recent.rb
@@ -55,16 +55,20 @@ ARGV.each do |fname|
rescue RSS::UnknownConversionMethodError
error($!) if verbose
end
- rss.items.each do |item|
- if item.respond_to?(:pubDate) and item.pubDate
- class << item
- alias_method(:dc_date, :pubDate)
- end
- end
- if item.respond_to?(:dc_date) and item.dc_date
- items << [rss.channel, item]
+
+ rss = rss.to_rss("1.0") do |maker|
+ maker.channel.about ||= maker.channel.link
+ maker.channel.description ||= "No description"
+ maker.items.each do |item|
+ item.title ||= "UNKNOWN"
+ item.link ||= "UNKNOWN"
end
end
+ next if rss.nil?
+
+ rss.items.each do |item|
+ items << [rss.channel, item] if item.dc_date
+ end
end
end
processing_time = Time.now - before_time