[vlc-commits] youtube.lua: be more flexible with JSON spaces

Pierre Ynard git at videolan.org
Wed Jan 28 18:04:21 CET 2015


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed Jan 28 18:02:25 2015 +0100| [42b4ab8ae47906466e27e22d25869afccb7ffa0d] | committer: Pierre Ynard

youtube.lua: be more flexible with JSON spaces

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=42b4ab8ae47906466e27e22d25869afccb7ffa0d
---

 share/lua/playlist/youtube.lua |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 11e5cac..2b7d40c 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -258,21 +258,21 @@ function parse()
             -- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ...
             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
                     js_url = string.gsub( js_url, "\\/", "/" )
                     js_url = string.gsub( js_url, "^//", vlc.access.."://" )
                 end
 
                 if not fmt then
-                    fmt_list = string.match( line, "\"fmt_list\": \"(.-)\"" )
+                    fmt_list = string.match( line, "\"fmt_list\": *\"(.-)\"" )
                     if fmt_list then
                         fmt_list = string.gsub( fmt_list, "\\/", "/" )
                         fmt = get_fmt( fmt_list )
                     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
                     -- FIXME: do this properly
                     url_map = string.gsub( url_map, "\\u0026", "&" )
@@ -282,7 +282,7 @@ function parse()
                 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\": \"(.-)\"" )
+                    local hlsvp = string.match( line, "\"hlsvp\": *\"(.-)\"" )
                     if hlsvp then
                         hlsvp = string.gsub( hlsvp, "\\/", "/" )
                         path = hlsvp



More information about the vlc-commits mailing list