Videos5
- Boyo-2
- Aug 3, 1999
diff --git a/lib/onebox/engine/allowlisted_generic_onebox.rb b/lib/onebox/engine/allowlisted_generic_onebox.rb index e264abed398..0ccc8ebee0a 100644 --- a/lib/onebox/engine/allowlisted_generic_onebox.rb +++ b/lib/onebox/engine/allowlisted_generic_onebox.rb @@ -42,6 +42,10 @@ module Onebox %w(slideshare.net dailymotion.com livestream.com imgur.com flickr.com) end + def self.article_html_hosts + %w(imdb.com) + end + def self.host_matches(uri, list) !!list.find { |h| %r((^|\.)#{Regexp.escape(h)}$).match(uri.host) } end @@ -59,7 +63,7 @@ module Onebox end def placeholder_html - return article_html if is_article? + return article_html if (is_article? || force_article_html?) return image_html if is_image? return Onebox::Helpers.video_placeholder_html if is_video? || is_card? return Onebox::Helpers.generic_placeholder_html if is_embedded? @@ -150,7 +154,7 @@ module Onebox end def generic_html - return article_html if is_article? + return article_html if (is_article? || force_article_html?) return video_html if is_video? return image_html if is_image? return embedded_html if is_embedded? @@ -207,6 +211,10 @@ module Onebox options[:allowed_iframe_regexes]&.any? { |r| src =~ r } end + def force_article_html? + AllowlistedGenericOnebox.host_matches(uri, AllowlistedGenericOnebox.article_html_hosts) && (has_text? || is_image_article?) + end + def card_html escaped_url = ::Onebox::Helpers.normalize_url_for_output(data[:player]) diff --git a/spec/fixtures/onebox/imdb.response b/spec/fixtures/onebox/imdb.response new file mode 100644 index 00000000000..ac6bb7a3020 --- /dev/null +++ b/spec/fixtures/onebox/imdb.response @@ -0,0 +1,2186 @@ +