Commit 0002ac10 authored by Pierre Ynard's avatar Pierre Ynard

youtube.lua: support live streams

This could use a bit more testing than a single video
(cherry picked from commit 64e30497fa764f680c2b235757e49f6c83b85028)
Signed-off-by: default avatarPierre Ynard <linkfanel@yahoo.fr>
parent 21466d50
......@@ -158,6 +158,16 @@ function parse()
url_map = string.gsub( url_map, "\\u0026", "&" )
path = pick_url( url_map, fmt )
end
if not path then
-- If this is a live stream, the URL map will be empty
-- and we get the URL from this field instead
local hlsvp = string.match( line, "\"hlsvp\": \"(.-)\"" )
if hlsvp then
hlsvp = string.gsub( hlsvp, "\\/", "/" )
path = hlsvp
end
end
-- There is also another version of the parameters, encoded
-- differently, as an HTML attribute of an <object> or <embed>
-- tag; but we don't need it now
......@@ -209,6 +219,16 @@ function parse()
path = pick_url( url_map, fmt )
end
if not path then
-- If this is a live stream, the URL map will be empty
-- and we get the URL from this field instead
local hlsvp = string.match( line, "&hlsvp=([^&]*)" )
if hlsvp then
hlsvp = vlc.strings.decode_uri( hlsvp )
path = hlsvp
end
end
if not path then
vlc.msg.err( "Couldn't extract youtube video URL, please check for updates to this script" )
return { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment