class DanceTime::Scraper

Public Instance Methods

get_page() click to toggle source
# File lib/dance_time/scraper.rb, line 3
def get_page
  Nokogiri::HTML(open("https://blog.feedspot.com/dance_youtube_channels/"))
end
make_channels() click to toggle source
# File lib/dance_time/scraper.rb, line 11
def make_channels
  scrape_channels.each do |channel_info|
    name = channel_info.css('.tlink').text
    about = channel_info.css('.data .d').text.gsub(/^Frequency.*$/, "").gsub(/^About Channel\s-\s/, "")
    youtube_link = channel_info.css('.data a').attribute('href').text
    frequency = channel_info.css('.data .d').text.gsub(/^((?!Frequency).)*$/, "")
    DanceTime::Channel.new(name, about, youtube_link, frequency)
  end
end
scrape_channels() click to toggle source
# File lib/dance_time/scraper.rb, line 7
def scrape_channels
  self.get_page.css(".trow-wrap")
end