| Manufacturer | + REXBETI |
|---|---|
| Item Weight | + 2.22 pounds |
| Package Dimensions | + 7.6 x 4.5 x 2.3 inches |
| Is Discontinued By Manufacturer | + No |
| Size | + Upgraded Style |
| Material | + Other |
| Batteries Included? | + No |
| Batteries Required? | + No |
-
+
- +
diff --git a/lib/onebox/engine/amazon_onebox.rb b/lib/onebox/engine/amazon_onebox.rb index 7f377ca01a..c30904067b 100644 --- a/lib/onebox/engine/amazon_onebox.rb +++ b/lib/onebox/engine/amazon_onebox.rb @@ -124,7 +124,12 @@ module Onebox elsif !raw.css("#priceblock_ourprice").inner_text.empty? raw.css("#priceblock_ourprice").inner_text else - raw.css(".mediaMatrixListItem.a-active .a-color-price").inner_text + result = raw.css('#corePrice_feature_div .a-price .a-offscreen').inner_text + if result.blank? + result = raw.css(".mediaMatrixListItem.a-active .a-color-price").inner_text + end + + result end end @@ -215,8 +220,10 @@ module Onebox summary = raw.at("#productDescription") - description = og.description || summary&.inner_text - description ||= raw.css("meta[name=description]").first&.[]("content") + description = og.description || summary&.inner_text&.strip + if description.blank? + description = raw.css("meta[name=description]").first&.[]("content") + end result[:description] = CGI.unescapeHTML(Onebox::Helpers.truncate(description, 250)) if description end diff --git a/spec/fixtures/onebox/amazon-alternate.response b/spec/fixtures/onebox/amazon-alternate.response new file mode 100644 index 0000000000..f8b92adad1 --- /dev/null +++ b/spec/fixtures/onebox/amazon-alternate.response @@ -0,0 +1,10497 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +