From 817b6c24c8bab175d103a83d920d1e7086357757 Mon Sep 17 00:00:00 2001 From: jbrw Date: Wed, 7 Apr 2021 12:29:39 -0400 Subject: [PATCH] DEV: lazy-yt plugin should attempt to use `parse_embed_response` (#12626) This requires the `parse_embed_response` method, which should be available in the `onebox` gem, version 2.2.11 (or thereabouts). --- plugins/lazy-yt/plugin.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/lazy-yt/plugin.rb b/plugins/lazy-yt/plugin.rb index b0ed271e360..c2756080b29 100644 --- a/plugins/lazy-yt/plugin.rb +++ b/plugins/lazy-yt/plugin.rb @@ -28,8 +28,10 @@ class Onebox::Engine::YoutubeOnebox video_height = (params['height'] && params['height'].to_i <= 500) ? params['height'] : 388 # embed height size_tags = ["width=\"#{video_width}\"", "height=\"#{video_height}\""] - og = get_opengraph.data - thumbnail_url = og[:image] || "https://img.youtube.com/vi/#{video_id}/hqdefault.jpg" + result = parse_embed_response + result ||= get_opengraph.data + + thumbnail_url = result[:image] || "https://img.youtube.com/vi/#{video_id}/hqdefault.jpg" # Put in the LazyYT div instead of the iframe escaped_title = ERB::Util.html_escape(video_title)