Sha256: 7c4e96539f58b5841dd1cc1ada656c15359897511a98be99de76a12fede7faec
Contents?: true
Size: 669 Bytes
Versions: 3
Compression:
Stored size: 669 Bytes
Contents
class Scraper def self.scrape_rt html = open ('http://www.eregulations.com/massachusetts/fishing/saltwater/commonly-caught-species/') doc = Nokogiri::HTML(html) #makes a string in an array list_objs = doc.css('.Basic-Graphics-Frame') #scrapes site further list_objs.each.with_index do |fish, i| fish_name = fish.css('h3').text #grabs just the fish name is_fish_name_empty = fish_name.to_s.empty? #within the code there is few without descriptions if !is_fish_name_empty fish_description = fish.css('p')[0].text Fish.new(fish_name, fish_description) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fish_finder-0.1.3 | lib/fish_finder/scraper.rb |
fish_finder-0.1.2 | lib/fish_finder/scraper.rb |
fish_finder-0.1.0 | lib/fish_finder/scraper.rb |