Skip to content
This repository was archived by the owner on Apr 3, 2021. It is now read-only.

Commit c8487f6

Browse files
committed
FIX: Amazon spec
1 parent 2a97dbb commit c8487f6

File tree

4 files changed

+13305
-773
lines changed

4 files changed

+13305
-773
lines changed

lib/oneboxer/amazon_onebox.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def template
1212

1313
# Use the mobile version of the site
1414
def translate_url
15-
1615
# If we're already mobile don't translate the url
1716
return @url if @url =~ /https?:\/\/www\.amazon\.com\/gp\/aw\/d\//
1817

@@ -26,9 +25,9 @@ def parse(data)
2625

2726
result = {}
2827
result[:title] = html_doc.at("h1")
29-
result[:title] = result[:title].inner_html if result[:title].present?
28+
result[:title] = result[:title].inner_text.strip if result[:title].present?
3029

31-
image = html_doc.at(".a-image-wrapper img")
30+
image = html_doc.at("#main-image")
3231
result[:image] = image['src'] if image
3332

3433
result[:by_info] = html_doc.at("#by-line")

spec/components/oneboxer/amazon_onebox_spec.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ def expected_amazon_result
3030
</div>
3131
</div>
3232
<div class='onebox-result-body'>
33-
<img src="http://ecx.images-amazon.com/images/I/716dULgyHNL._SY180_.jpg" class="thumbnail">
34-
<h3><a href="http://www.amazon.com/Ruby-Programming-Language-David-Flanagan/dp/0596516177" target="_blank">The Ruby Programming Language (Paperback)</a></h3>
35-
<h4>David Flanagan, Yukihiro Matsumoto</h4>
36-
37-
The Ruby Programming Language is the authoritative guide to Ruby ...
33+
<img src="http://ecx.images-amazon.com/images/I/512Cx%2BnJK8L._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA300_SH20_OU01_.jpg" class="thumbnail">
34+
<h3><a href="http://www.amazon.com/Ruby-Programming-Language-David-Flanagan/dp/0596516177" target="_blank">The Ruby Programming Language [Paperback]</a></h3>
35+
3836
3937
</div>
4038
<div class='clearfix'></div>

0 commit comments

Comments
 (0)