mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 17:52:45 +08:00
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).
This commit is contained in:
parent
70c0863114
commit
817b6c24c8
@ -28,8 +28,10 @@ class Onebox::Engine::YoutubeOnebox
|
|||||||
video_height = (params['height'] && params['height'].to_i <= 500) ? params['height'] : 388 # embed height
|
video_height = (params['height'] && params['height'].to_i <= 500) ? params['height'] : 388 # embed height
|
||||||
size_tags = ["width=\"#{video_width}\"", "height=\"#{video_height}\""]
|
size_tags = ["width=\"#{video_width}\"", "height=\"#{video_height}\""]
|
||||||
|
|
||||||
og = get_opengraph.data
|
result = parse_embed_response
|
||||||
thumbnail_url = og[:image] || "https://img.youtube.com/vi/#{video_id}/hqdefault.jpg"
|
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
|
# Put in the LazyYT div instead of the iframe
|
||||||
escaped_title = ERB::Util.html_escape(video_title)
|
escaped_title = ERB::Util.html_escape(video_title)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user