Commit 64e30497 authored by Pierre Ynard's avatar Pierre Ynard

youtube.lua: support live streams

This could use a bit more testing than a single video
parent 88671de6
...@@ -158,6 +158,16 @@ function parse() ...@@ -158,6 +158,16 @@ function parse()
url_map = string.gsub( url_map, "\\u0026", "&" ) url_map = string.gsub( url_map, "\\u0026", "&" )
path = pick_url( url_map, fmt ) path = pick_url( url_map, fmt )
end 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 -- There is also another version of the parameters, encoded
-- differently, as an HTML attribute of an <object> or <embed> -- differently, as an HTML attribute of an <object> or <embed>
-- tag; but we don't need it now -- tag; but we don't need it now
...@@ -209,6 +219,16 @@ function parse() ...@@ -209,6 +219,16 @@ function parse()
path = pick_url( url_map, fmt ) path = pick_url( url_map, fmt )
end 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 if not path then
vlc.msg.err( "Couldn't extract youtube video URL, please check for updates to this script" ) vlc.msg.err( "Couldn't extract youtube video URL, please check for updates to this script" )
return { } 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