0

In my sample project, I am trying to read one new ress feed and I am using most popular gem 'feedjira' but I am not able to fetch the values. I tried simple-rss gem as well.

Still no progress.

user@localhost ~]$ irb
2.1.2 :001 > urls = %w[http://feedjira.com/blog/feed.xml https://github.com/feedjira/feedjira/feed.xml]
 => ["http://feedjira.com/blog/feed.xml", "https://github.com/feedjira/feedjira/feed.xml"] 
2.1.2 :002 > feeds = Feedjira::Feed.fetch_and_parse urls # returns a Hash, with each url having a Feedjira::Feed object
NameError: uninitialized constant Feedjira
    from (irb):2
    from /home/user/.rvm/rubies/ruby-2.1.2/bin/irb:11:in `<main>'

Please have a look and suggest something.

Rubyist
  • 6,486
  • 10
  • 51
  • 86

1 Answers1

0

After a googling, I found one script related to fetching the RSS feed. Working fine but some times it reply the output and some times 401 as status code.

Not sure what is the reason and still investigating.

require 'feedjira'
feed_parsed = Feedjira::Feed.fetch_and_parse("https://news.yahoo.com/rss/topstories", 
                                                          {:ssl_verify_peer => false})
puts feed_parsed
Rubyist
  • 6,486
  • 10
  • 51
  • 86
  • If you want to avoid the hassle of fetching (and dealing with errors) as well as the hassle of mapping different feed formats into a pre-defined schema, check [Superfeedr](https://superfeedr.com/). We do Webhook + JSON to help you with both! – Julien Genestoux Oct 14 '14 at 10:09