[vlc-commits] youtube.lua: handle multiline statements in signature descrambling javascript
Pierre Ynard
git at videolan.org
Wed Nov 25 02:55:41 CET 2015
vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed Nov 25 02:50:10 2015 +0100| [71b243f49fa89807adb30e84d026a0318200ccdc] | committer: Pierre Ynard
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
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=71b243f49fa89807adb30e84d026a0318200ccdc
---
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 53dc43b..7089960 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -62,7 +62,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