lib/onebox/engine/youtube_onebox.rb in onebox-1.5.21 vs lib/onebox/engine/youtube_onebox.rb in onebox-1.5.22

- old
+ new

@@ -3,10 +3,11 @@ class YoutubeOnebox include Engine include StandardEmbed matches_regexp(/^https?:\/\/(?:www\.)?(?:m\.)?(?:youtube\.com|youtu\.be)\/.+$/) + always_https # Try to get the video ID. Works for URLs of the form: # * https://www.youtube.com/watch?v=Z0UISCEe52Y # * http://youtu.be/afyK1HSFfgw # * https://www.youtube.com/embed/vsF0K3Ou1v0 @@ -56,11 +57,11 @@ html end def video_title - yt_oembed_url = "http://www.youtube.com/oembed?format=json&url=http://www.youtube.com/watch?v=#{video_id.split('?')[0]}" + yt_oembed_url = "https://www.youtube.com/oembed?format=json&url=https://www.youtube.com/watch?v=#{video_id.split('?')[0]}" yt_oembed_data = Onebox::Helpers.symbolize_keys(::MultiJson.load(Onebox::Helpers.fetch_response(yt_oembed_url).body)) yt_oembed_data[:title] rescue return nil end @@ -110,14 +111,9 @@ (h * 60 * 60) + (m * 60) + s else nil end - end - - # Note: May throw! Make sure to recue. - def uri - @_uri ||= URI(@url) end def params return {} unless uri.query # This mapping is necessary because CGI.parse returns a hash of keys to arrays.