Skip to content

Instantly share code, notes, and snippets.

@Papillard
Last active November 16, 2016 16:33
Show Gist options
  • Save Papillard/1648941e1349e49ba3949892be289c26 to your computer and use it in GitHub Desktop.
Save Papillard/1648941e1349e49ba3949892be289c26 to your computer and use it in GitHub Desktop.
Smorrebrod restaurant scraper
require "open-uri"
require "nokogiri"
url = "http://www.visitdenmark.com/copenhagen/gastronomy/smorrebrod-restaurants-copenhagen"
html_file = open(url)
doc = Nokogiri::HTML(html_file)
doc.search(".gdkProduct").each do |smorrebrod|
p smorrebrod.search(".ProductImage")[0].attr("src")
p smorrebrod.search("h2").text
p smorrebrod.search(".ProductTextList")[0].text.strip
p "*" * 10
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment