lib/onebox/engine/standard_embed.rb in onebox-1.7.5 vs lib/onebox/engine/standard_embed.rb in onebox-1.7.6

- old
+ new

@@ -48,11 +48,11 @@ end protected def html_doc - @html_doc ||= Nokogiri::HTML(Onebox::Helpers.fetch_response(url).body) rescue nil + @html_doc ||= Nokogiri::HTML((Onebox::Helpers.fetch_response(url) rescue nil)) end def get_oembed oembed_url = nil @@ -75,10 +75,11 @@ end end return {} if Onebox::Helpers.blank?(oembed_url) - oe = Onebox::Helpers.symbolize_keys(::MultiJson.load(Onebox::Helpers.fetch_response(oembed_url).body)) + json_response = Onebox::Helpers.fetch_response(oembed_url) rescue "{}" + oe = Onebox::Helpers.symbolize_keys(::MultiJson.load(json_response)) # never use oembed from WordPress 4.4 (it's broken) oe.delete(:html) if oe[:html] && oe[:html]["wp-embedded-content"] oe