开发者

Feedzirra cannot parse atom feeds

开发者 https://www.devze.com 2023-02-05 14:40 出处:网络
The idea of having a single parser for any kind of feed is great and was hoping that it would work for me.

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. s开发者_JS百科pecifically:

  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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号