Advertisement
Guest User

Untitled

a guest
Jan 12th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. require 'open-uri'
  2. require 'nokogiri'
  3.  
  4. url = 'http://www.petsonic.com/es/perros/snacks-y-huesos-perro/galletas-granja-para-perro'
  5. html = open(url)
  6.  
  7. doc = Nokogiri::HTML(html)
  8.  
  9. names = []
  10. doc.xpath('//div[@class = "attribute_list"]/*' ).each do |row|
  11.  
  12.  
  13. tempName = row.at_xpath('//span[@class = "attribute_name"]')
  14. tempPrice = row.at_xpath('//span[@class = "attribute_price"]')
  15.  
  16. puts tempName
  17. puts tempPrice
  18. end
  19.  
  20. //span[@class = "attribute_name"]
  21.  
  22. //span[@class = "attribute_price"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement