From: Kouhei Sutou Date: 2013-03-20T09:48:18+09:00 Subject: Re: RSS standard lib? Hi, In "RSS standard lib?" on Wed, 20 Mar 2013 06:47:35 +0900, Hal Fulton wrote: > I used to use "feedtools" (now defunct) and I am trying to switch over > to the RSS stdlib. > > Can anyone tell me why this doesn't work? (Error below) ... > require 'rss' > require 'open-uri' > > URL = "http://feeds.space.com/SpacecomUniversalSpacePodcast" > > rss = open(URL).read > feed = RSS::Parser.parse(rss) > puts "Description: #{feed.title}" > feed.items.each.with_index {|item,i| puts "#{i+1}. #{item.title}" } Try the following: require 'rss' require 'open-uri' URL = "http://feeds.space.com/SpacecomUniversalSpacePodcast" rss = open(URL).read feed = RSS::Parser.parse(rss, false) puts "Description: #{feed.channel.title}" feed.items.each.with_index {|item,i| puts "#{i+1}. #{item.title}" } Points: * Add false argument to RSS::Parser.parse as the second argument. It means "the parser doesn't validate value". * Change "feed.title" to "feed.channel.title". /rss/channel/title is the title of the feed in RSS 2.0. Thanks, -- kou