lib/onebox/engine/amazon_onebox.rb in onebox-1.3.2 vs lib/onebox/engine/amazon_onebox.rb in onebox-1.3.3

- old
+ new

@@ -4,14 +4,18 @@ include Engine include LayoutSupport include HTML - matches_regexp(/^http:\/\/(?:www)\.amazon\.(com|ca)/) + matches_regexp(/^http:\/\/(?:www)\.amazon\.(?<tld>com|ca|de|it|es|fr|co\.jp|co\.uk|cn|in|com\.br)\//) def url - return "http://www.amazon.com/gp/aw/d/" + URI::encode(match[:id]) if match && match[:id] + return "http://www.amazon.#{tld}/gp/aw/d/" + URI::encode(match[:id]) if match && match[:id] @url + end + + def tld + @tld || @@matcher.match(@url)["tld"] end def http_params {'User-Agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3'} end