2

The idea of having a single parser for any kind of feed is great and was hoping that it would work for me. I have been trying to get feedzirra to parse atom feeds. specifically:

  1. http://pindancing.blogspot.com/feeds/posts/default
  2. http://adam.heroku.com/feed

Those are just 2 that I tried with the problem is that feedzirra cannot parse the entry URL. It always comes out nil

feed = Feedzirra::Feed.fetch_and_parse(search.rss_feed_url)
p feed.entries.first.title
p feed.entries.first.url #=> returns nil

Is there anything I need to do to get it working?

thanks for your help

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
truthSeekr
  • 1,603
  • 4
  • 25
  • 44

1 Answers1

3

Hate to say "works for me", but, well, works for me:

require 'Feedzirra'

urls = %w{
  http://adam.heroku.com/feed
  http://pindancing.blogspot.com/feeds/posts/default
}

urls.each do |url|
  feed = Feedzirra::Feed.fetch_and_parse(url)
  puts feed.entries.first.title
  puts feed.entries.first.url
end

# => Memcached, a Database?
# => http://adam.heroku.com/past/2010/7/19/memcached_a_database/
# => The answer to "Will you mentor me?" is
# => http://pindancing.blogspot.com/2010/12/answer-to-will-you-mentor-me-is.html 

It'd help to see the rest of your code, particularly the actual parameter you're using in the fetch_and_parse method.

michaelmichael
  • 13,755
  • 7
  • 54
  • 60
  • Thanks Michael, I am using 'feedzirra' (which is pauldix-feedzirra (0.0.18) gem). I tried your code on my machine and it does not work. May be I need to update the gem? my ruby version is 1.8.7 – truthSeekr Jan 20 '11 at 20:49
  • The latest version of Feedzirra is 0.0.24. That's what I'm using. I've tried on Ruby 1.8.7-p302 and Ruby 1.9.2-p136 and the above code works fine with both. – michaelmichael Jan 20 '11 at 21:21
  • Michael, feedzirra version could be the issue. I tried updating it but now stuck with activesupport dependencies '`activate': can't activate activesupport (>= 2.3.8, runtime) for ["feedzirra-0.0.24"], already activated activesupport-2.3.5 for ["activerecord-2.3.5"] (Gem::LoadError)' If you know of a solution let me know. I will also look around to figure out how to avoid the dependency. thanks – truthSeekr Jan 20 '11 at 21:52
  • Finally was able to get activesupport installed and feedzirra upgraded to 0.0.24 version. Still the same result for URL value. It baffles me. Michael, can you please post what version of nokogiri gem do you have installed? that might be the last thing I check before I give up on feedzirra and try something else. Thanks – truthSeekr Jan 21 '11 at 07:06
  • An update for feedzirra and atom feeds: It apparently is a known issue as mentioned in the google group for feedzirra http://groups.google.com/group/feedzirra/browse_thread/thread/69b330f99de94b1c – truthSeekr Jan 21 '11 at 07:27
  • 2
    I'm using version 1.4.3.1 of Nokogiri. Someone at the end of the thread you link to mentions that using this version fixes the issue for them. – michaelmichael Jan 21 '11 at 14:46
  • That worked. Thanks a ton Michael. gem 'nokogiri', '= 1.4.3.1' did the trick. – truthSeekr Jan 21 '11 at 17:10