Sha256: 07c72339b8b26af26f20944906f1d7a139036411a209752532dce0ed90a4c7e1

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

class CoffeeRoasters::Scraper

  def scrape_roasters
    doc = Nokogiri::HTML(open("https://www.thrillist.com/drink/nation/the-21-best-coffee-roasters-in-the-country"))

    section = doc.css("section.save-venue")
    section.each do |data|
# binding.pry
      roaster = CoffeeRoasters::Roaster.new

      roaster.name = data.css("h1 a.save-venue__link").text
      roaster.location = data.css("h2.save-venue__neighborhood").text
      roaster.bean = data.css("p.save-venue__description").text.split("\n")[0]
      roaster.details = data.css("p.save-venue__description").text.split("\n")[2]
      roaster.url = data.css("a.save-venue__link").attr("href").value

      roaster.save
    end
  
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coffee_roasters-0.1.4 lib/coffee_roasters/scraper.rb
coffee_roasters-0.1.3 lib/coffee_roasters/scraper.rb
coffee_roasters-0.1.2 lib/coffee_roasters/scraper.rb
coffee_roasters-0.1.0 lib/coffee_roasters/scraper.rb