Commit 2a4caf19 authored by Pierre Ynard's avatar Pierre Ynard Committed by Felix Paul Kühne

youtube.lua: be more flexible with JSON spaces

(cherry picked from commit 42b4ab8ae47906466e27e22d25869afccb7ffa0d)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 5392e7e7
...@@ -258,21 +258,21 @@ function parse() ...@@ -258,21 +258,21 @@ function parse()
-- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ... -- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ...
if string.match( line, "ytplayer%.config" ) then if string.match( line, "ytplayer%.config" ) then
local js_url = string.match( line, "\"js\": \"(.-)\"" ) local js_url = string.match( line, "\"js\": *\"(.-)\"" )
if js_url then if js_url then
js_url = string.gsub( js_url, "\\/", "/" ) js_url = string.gsub( js_url, "\\/", "/" )
js_url = string.gsub( js_url, "^//", vlc.access.."://" ) js_url = string.gsub( js_url, "^//", vlc.access.."://" )
end end
if not fmt then if not fmt then
fmt_list = string.match( line, "\"fmt_list\": \"(.-)\"" ) fmt_list = string.match( line, "\"fmt_list\": *\"(.-)\"" )
if fmt_list then if fmt_list then
fmt_list = string.gsub( fmt_list, "\\/", "/" ) fmt_list = string.gsub( fmt_list, "\\/", "/" )
fmt = get_fmt( fmt_list ) fmt = get_fmt( fmt_list )
end end
end end
url_map = string.match( line, "\"url_encoded_fmt_stream_map\": \"(.-)\"" ) url_map = string.match( line, "\"url_encoded_fmt_stream_map\": *\"(.-)\"" )
if url_map then if url_map then
-- FIXME: do this properly -- FIXME: do this properly
url_map = string.gsub( url_map, "\\u0026", "&" ) url_map = string.gsub( url_map, "\\u0026", "&" )
...@@ -282,7 +282,7 @@ function parse() ...@@ -282,7 +282,7 @@ function parse()
if not path then if not path then
-- If this is a live stream, the URL map will be empty -- If this is a live stream, the URL map will be empty
-- and we get the URL from this field instead -- and we get the URL from this field instead
local hlsvp = string.match( line, "\"hlsvp\": \"(.-)\"" ) local hlsvp = string.match( line, "\"hlsvp\": *\"(.-)\"" )
if hlsvp then if hlsvp then
hlsvp = string.gsub( hlsvp, "\\/", "/" ) hlsvp = string.gsub( hlsvp, "\\/", "/" )
path = hlsvp path = hlsvp
......
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