[vlc-commits] youtube.lua: handle multiline statements in signature descrambling javascript

Pierre Ynard git at videolan.org
Wed Nov 25 10:02:06 CET 2015


vlc/vlc-2.2 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed Nov 25 02:50:10 2015 +0100| [b98069fbfea8773b1245ce29803cb5b06d8d0359] | committer: Felix Paul Kühne

youtube.lua: handle multiline statements in signature descrambling javascript

Join such statements into a single line, as it breaks our line-based
parsing when one of our statements of interest gets split

(cherry picked from commit 71b243f49fa89807adb30e84d026a0318200ccdc)
Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

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

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index a50a624..f6b1fe4 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -73,7 +73,14 @@ function buf_iter( s )
     s.i = s.i + 1
     local line = s.lines[s.i]
     if not line then
-        line = s.stream:readline()
+        -- Put back together statements split across several lines,
+        -- otherwise we won't be able to parse them
+        repeat
+            local l = s.stream:readline()
+            if not l then break end
+            line = line and line..l or l -- Ternary operator
+        until string.match( line, "};$" )
+
         if line then
             s.lines[s.i] = line
         end



More information about the vlc-commits mailing list