lib/fletcher/models/amazon.rb in fletcher-0.6.4 vs lib/fletcher/models/amazon.rb in fletcher-0.6.5
- old
+ new
@@ -11,24 +11,27 @@
super(data)
case doc
when Nokogiri::HTML::Document
# Get Name
- self.name = doc.css("h1#title").first_string
+ self.name = doc.css("h1#title").first_string
+ self.name = doc.xpath("string(//title)").split(" - ").first unless self.name
# Get Description
- self.description = doc.css("div#productDescriptionWrapper").first_string
+ self.description = doc.css(".productDescriptionWrapper").first_string
# Get description from meta title if not found
self.description = doc.xpath("//meta[@name='description']/@content").first_string if description.nil?
# Get Price
- parse_price(doc.css("#priceblock_ourprice").first_string)
-
+ parse_price(doc.css("#actualPriceValue").first_string)
+ parse_price(doc.css("#priceblock_ourprice").first_string) unless self.price
parse_price(doc.css("#priceblock_saleprice").first_string) unless self.price
+ parse_price(doc.xpath("//span[contains(@id, 'price')]").first_string) unless self.price
# Get Images
self.images = doc.xpath("//*[@data-action='main-image-click']//img").attribute_array
+ self.images = doc.xpath("//*[@id='imageBlock']//img").attribute_array unless self.images
self.image = images.first
end
end
end
end
\ No newline at end of file