lib/onebox/engine/standard_embed.rb in onebox-1.8.25 vs lib/onebox/engine/standard_embed.rb in onebox-1.8.26
- old
+ new
@@ -53,24 +53,10 @@
return @html_doc if @html_doc
headers = nil
headers = { 'Cookie' => options[:cookie] } if options[:cookie]
- response = (Onebox::Helpers.fetch_response(url, nil, nil, headers) rescue nil)
- doc = Nokogiri::HTML(response)
-
- ignore_canonical = doc.at('meta[property="og:ignore_canonical"]')
- unless ignore_canonical && ignore_canonical['content'].to_s == 'true'
- # prefer canonical link
- canonical_link = doc.at('//link[@rel="canonical"]/@href')
- if canonical_link && "#{URI(canonical_link).host}#{URI(canonical_link).path}" != "#{URI(url).host}#{URI(url).path}"
- response = (Onebox::Helpers.fetch_response(canonical_link, nil, nil, headers) rescue nil)
- doc = Nokogiri::HTML(response) if response
- end
- end
-
- @html_doc = doc
- @html_doc
+ @html_doc = Onebox::Helpers.fetch_html_doc(url, headers)
end
def get_oembed
oembed_url = nil