Class: Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/covid_19_updates/scraper.rb

Class Method Summary collapse

Class Method Details

.fetch(array, pick, network) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/covid_19_updates/scraper.rb', line 2

def self.fetch(array, pick, network)
  case network
  when 'cnbc'
    print Nokogiri::HTML(URI.open((array[pick.to_i - 1][:link]).to_s)).css('div.group').text.gsub('Â', '').light_blue
    puts
  when 'stat'
    print Nokogiri::HTML(URI.open((array[pick.to_i - 1][:link]).to_s)).css('a.post-title-link').text.light_blue
    puts
  end
end