Class: DanceTime::Scraper
- Inherits:
-
Object
- Object
- DanceTime::Scraper
- Defined in:
- lib/dance_time/scraper.rb
Instance Method Summary collapse
Instance Method Details
#get_page ⇒ Object
3 4 5 |
# File 'lib/dance_time/scraper.rb', line 3 def get_page Nokogiri::HTML(open("https://blog.feedspot.com/dance_youtube_channels/")) end |
#make_channels ⇒ Object
11 12 13 14 15 16 17 18 19 |
# 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 ⇒ Object
7 8 9 |
# File 'lib/dance_time/scraper.rb', line 7 def scrape_channels self.get_page.css(".trow-wrap") end |