class TopTv::Scraper

Public Class Methods

make_headings() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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