Ruby tutorials - rss

RSS

Install gem

1
gem install feedjira

Parse RSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require 'feedjira'
feedurl = 'https://www.yuxifan.com/atom.xml'
feed = Feedjira::Feed.fetch_and_parse feedurl
puts feed.title
puts feed.url
puts feed.entries.length
feed.entries.each do |item|
puts item.title
puts '------------'
puts item.url
puts ' '
end
Share