Class: TopTv::Scraper
- Inherits:
-
Object
- Object
- TopTv::Scraper
- Defined in:
- lib/top_tv/scraper.rb
Class Method Summary collapse
Class Method Details
.make_headings ⇒ Object
9 10 11 12 13 |
# File 'lib/top_tv/scraper.rb', line 9 def self.make_headings self.scrape_headings.each do |heading| TopTv::Heading.new_from_home_page(heading) end end |
.make_shows ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/top_tv/scraper.rb', line 15 def self.make_shows headings = self.scrape_headings shows = headings.css("tr td.middle_col a") #all shows shows.each do |show| TopTv::Show.new_from_home_page(show) end end |
.scrape_headings ⇒ Object
3 4 5 6 7 |
# File 'lib/top_tv/scraper.rb', line 3 def self.scrape_headings doc = Nokogiri::HTML(open("https://www.rottentomatoes.com/top-tv/")) #scrape home page left_column = doc.css("div.col-left").first #all left col headings and shows headings = left_column.css("section") #all headings and their shows, separated end |