lib/onebox/engine/amazon_onebox.rb in onebox-2.2.12 vs lib/onebox/engine/amazon_onebox.rb in onebox-2.2.13

- old
+ new

@@ -12,10 +12,12 @@ always_https matches_regexp(/^https?:\/\/(?:www\.)?(?:smile\.)?(amazon|amzn)\.(?<tld>com|ca|de|it|es|fr|co\.jp|co\.uk|cn|in|com\.br|com\.mx|nl|pl|sa|sg|se|com\.tr|ae)\//) def url + @raw ||= nil + # If possible, fetch the cached HTML body immediately so we can # try to grab the canonical URL from that document, # rather than guess at the best URL structure to use if body_cacher&.respond_to?('cache_response_body?') if body_cacher.cache_response_body?(uri.to_s) && body_cacher.cached_response_body_exists?(uri.to_s) @@ -34,10 +36,10 @@ @url end def tld - @tld || @@matcher.match(@url)["tld"] + @tld ||= @@matcher.match(@url)["tld"] end def http_params if @options && @options[:user_agent] { 'User-Agent' => @options[:user_agent] }