gpt4 book ai didi

ruby - Feedzirra 无法解析原子提要

转载 作者:数据小太阳 更新时间:2023-10-29 08:54:32 27 4
gpt4 key购买 nike

为任何类型的提要提供一个解析器的想法很棒,我希望它对我有用。我一直在尝试让 feedzirra 解析原子提要。具体来说:

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

这些只是我尝试过的 2 个问题是 feedzirra 无法解析入口网址。结果总是nil

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

我需要做些什么才能让它正常工作吗?

谢谢你的帮助

最佳答案

讨厌说“对我有用”,但是,嗯,对我有用:

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

这有助于查看您的其余代码,尤其是您在 fetch_and_parse 方法中使用的实际参数。

关于ruby - Feedzirra 无法解析原子提要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4751447/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com