Skip to content

Instantly share code, notes, and snippets.

@smartynko
Forked from radar/Nokogiri scraper
Created January 27, 2017 01:02
Show Gist options
  • Save smartynko/0072ea84ec2dd7f0844542cbba73dbb1 to your computer and use it in GitHub Desktop.
Save smartynko/0072ea84ec2dd7f0844542cbba73dbb1 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'nokogiri'
require 'open-uri'
page = Nokogiri::HTML(open("http://v-tac.eu/led-lights/lights1/led-spotlights/led-spotlight-7w-gu10-smd-white-plastic-white-detail.html"))
puts page.class # => Nokogiri::HTML::Document
fields = page.css(".product-field-type-S")
fields.each do |field|
key = field.css(".product-fields-title").text
value = field.css(".product-field-display").text
puts "#{key}: #{value}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment