1

I am trying to use feedzirra to grab rss/atom feeds, but feedzirra doesn't seem to find updates. I start by grabbing new feed and dumping the returned structure to a file.

require 'rubygems'
require 'yaml'
require 'feedzirra'
feed = Feedzirra::Feed.fetch_and_parse("http://rss.slashdot.org/Slashdot/slashdot")
File.open('slashdot.yaml','w'){|f| f.puts feed.to_yaml}

Then I wait a while, so that there are update to the feed, and I try:

require 'rubygems'
require 'yaml'
require 'feedzirra'
feed = YAML.load_file('slashdot.yaml')
puts feed.entries.first.published
updated_feed = Feedzirra::Feed.update(feed)
puts updated_feed.new_entries.first.published
all_new = Feedzirra::Feed.fetch_and_parse("http://rss.slashdot.org/Slashdot/slashdot")
puts all_new.entries.first.published

This results in:

Thu Apr 04 15:28:00 UTC 2013
Thu Apr 04 15:28:00 UTC 2013
Thu Apr 04 21:50:00 UTC 2013

The third line confirms that there are newer posts available, but Feed.update doesn't see them.

What am I doing wrong?

Darshan Rivka Whittle
  • 32,989
  • 7
  • 91
  • 109
  • Huh, your code actually works fine for me. What's weird is that you're using `new_entries`, not `entries`, so if there weren't new entries available, you'd get an error trying to call `published` on `nil`. – Darshan Rivka Whittle Apr 25 '13 at 17:24

0 Answers0