lib/onebox/engine/standard_embed.rb in onebox-1.5.62 vs lib/onebox/engine/standard_embed.rb in onebox-1.5.63

- old
+ new

@@ -39,11 +39,11 @@ oembed.each { |k, v| @raw[k] ||= v unless Onebox::Helpers::blank?(v) } @raw end - private + protected def html_doc return @html_doc if @html_doc response = Onebox::Helpers.fetch_response(url) @html_doc = Nokogiri::HTML(response.body) @@ -81,11 +81,12 @@ og[$1.tr('-:','_').to_sym] ||= value unless Onebox::Helpers::blank?(value) end end # Attempt to retrieve the title from the meta tag - if title = html_doc.at_css('title').try(:text) - og[:title] ||= title unless Onebox::Helpers.blank?(title) + title_element = html_doc.at_css('title') + if title_element && title_element.text + og[:title] ||= title_element.text unless Onebox::Helpers.blank?(title_element.text) end og end