lib/onebox/engine/standard_embed.rb in onebox-1.7.1 vs lib/onebox/engine/standard_embed.rb in onebox-1.7.2
- old
+ new
@@ -59,17 +59,19 @@
oembed_url = "#{endpoint}?url=#{url}"
break
end
end
- if Onebox::Helpers.blank?(oembed_url)
- application_json = html_doc.at("//link[@type='application/json+oembed']/@href")
- oembed_url = application_json.value if application_json
- end
+ if html_doc
+ if Onebox::Helpers.blank?(oembed_url)
+ application_json = html_doc.at("//link[@type='application/json+oembed']/@href")
+ oembed_url = application_json.value if application_json
+ end
- if Onebox::Helpers.blank?(oembed_url)
- text_json = html_doc.at("//link[@type='text/json+oembed']/@href")
- oembed_url ||= text_json.value if text_json
+ if Onebox::Helpers.blank?(oembed_url)
+ text_json = html_doc.at("//link[@type='text/json+oembed']/@href")
+ oembed_url ||= text_json.value if text_json
+ end
end
return {} if Onebox::Helpers.blank?(oembed_url)
oe = Onebox::Helpers.symbolize_keys(::MultiJson.load(Onebox::Helpers.fetch_response(oembed_url).body))