Skip to content

Instantly share code, notes, and snippets.

@dusk0r
Created March 29, 2017 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dusk0r/e1bcbd2a182eb4c4af2d2078f6af6f6c to your computer and use it in GitHub Desktop.
Save dusk0r/e1bcbd2a182eb4c4af2d2078f6af6f6c to your computer and use it in GitHub Desktop.
Digitec.ch Preis für Produkt
require 'RestClient'
require 'nokogiri'
def getPrice(productId)
res = RestClient.get "https://www.digitec.ch/de/s1/product/#{productId}"
doc = Nokogiri::HTML(res.to_s)
doc.css("#product_reviewed > article .product-price").first.xpath('text()').text.strip.gsub("\u2013", "0").to_f
end
productId = '5721031'
puts "Preis #{productId}: #{getPrice(productId)} Fr."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment