3 ms·
Here's the hazard values sorted by brand, for brands with 3 or more products listed: ["365 Whole Foods Market", [0, 0, 0, 1, 1]] ["Badia", [0, 0, 0, 0,
by perihelions 5y ago
Here's the hazard values sorted by brand, for brands with 3 or more products listed:
["365 Whole Foods Market", [0, 0, 0, 1, 1]]
["Badia", [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]]
["El Guapo", [0, 0, 0]]
["Great Value", [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]]
["Happy Belly", [0, 0, 3]]
["Kirkland Signature", [0, 0, 1]]
["La Flor", [0, 0, 1, 3, 3]]
["McCormick", [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]]
["Morton & Bassett", [0, 0, 0, 0, 0, 0, 1, 1, 1, 1]]
["Penzeys Spices", [0, 0, 0, 0, 1]]
["Sadaf", [0, 0, 0, 0, 1]]
["Simply Organic", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]
["Spice Islands", [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2]]
["Tone’s", [0, 1, 2]]
Here's a Ruby snippet to mine the relevant data from the OP page, as csv:
require 'nokogiri'
doc = Nokogiri::HTML(File.open(ARGV[0]).read)
doc.xpath('//div[@class="OneWholeSpice"]').map do |nd|
spice = nd.xpath('div[@class="spiceTitleBar"]').first.inner_text
# workaround for one missing </div>
nd.xpath('//div[@class="OneWholeSpice"]').each {|nd| nd.remove}
brands = nd.xpath('.//ul[@class="spBrand"]/..').each do |nd|
brand = nd.xpath('.//span[@class="sbCopybld"]').first.inner_text.strip
rating = nd.xpath('.//div[@class="noReccommendCircle"] | .//div[@class="noReccommendCircleKey"]').length
puts "\"#{spice}\",\"#{brand}\",#{rating}"
end
end