Created
March 29, 2017 13:24
-
-
Save dusk0r/e1bcbd2a182eb4c4af2d2078f6af6f6c to your computer and use it in GitHub Desktop.
Revisions
-
dusk0r created this gist
Mar 29, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ 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."