def attempt_oembed
response = OEmbed::Providers.get(@url)
+ return false unless response.respond_to?(:type)
+
@card.type = response.type
@card.title = response.respond_to?(:title) ? response.title : ''
@card.author_name = response.respond_to?(:author_name) ? response.author_name : ''
detector.strip_tags = true
guess = detector.detect(html, response.charset)
- page = Nokogiri::HTML(html, nil, guess&.fetch(:encoding))
+ page = Nokogiri::HTML(html, nil, guess&.fetch(:encoding, nil))
if meta_property(page, 'twitter:player')
@card.type = :video