forked from talaatmagdyx/rss_feed_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.rb
More file actions
29 lines (23 loc) · 800 Bytes
/
Copy pathparser.rb
File metadata and controls
29 lines (23 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'rss_feed'
require 'nokogiri'
# require 'open-uri'
#
# # url = 'https://feeds.nbcnews.com/nbcnews/public/news'
# # url = 'https://abcnews.go.com/abcnews/usheadlines'
# url = 'https://feeds.nbcnews.com/nbcnews/public/news'
# url = 'https://www.ruby-lang.org/en/feeds/news.rss'
# rss = RssFeed::Parser.new(url).parse
# p rss
# Define your custom options
feed_urls = 'https://feeds.nbcnews.com/nbcnews/public/news'
xml_parser = Nokogiri
uri_parser = URI
timeout = 10
# Initialize the Parser class with custom options
parser = RssFeed::Parser.new(feed_urls, xml_parser: xml_parser, uri_parser: uri_parser, timeout: timeout)
# Parse the RSS feeds
# parsed_data = parser.parse
# Process the parsed data
# puts parsed_data.inspect
parsed_data = parser.parse_as_object
puts parsed_data.inspect