[vlc-commits] youtube.lua: more flexible variable declaration parsing in javascript

Pierre Ynard git at videolan.org
Mon Dec 21 13:27:38 CET 2015


vlc/vlc-2.2 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Dec 19 17:45:55 2015 +0100| [dcc6b6ade45449234b02c0c0cc7e6adf34283ce1] | committer: Felix Paul Kühne

youtube.lua: more flexible variable declaration parsing in javascript

This copes with: var a=...,b=...;

(cherry picked from commit 623c46ba4ded47624ae4f840b58e8c1227325c74)
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=dcc6b6ade45449234b02c0c0cc7e6adf34283ce1
---

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

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index f6b1fe4..9ccab97 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -123,7 +123,7 @@ function js_descramble( sig, js_url )
 
     -- Fetch the code of the descrambler function
     -- var Go=function(a){a=a.split("");Fo.sH(a,2);Fo.TU(a,28);Fo.TU(a,44);Fo.TU(a,26);Fo.TU(a,40);Fo.TU(a,64);Fo.TR(a,26);Fo.sH(a,1);return a.join("")};
-    local rules = js_extract( js, "var "..descrambler.."=function%([^)]*%){(.-)};",
+    local rules = js_extract( js, "[ ,]"..descrambler.."=function%([^)]*%){(.-)};",
                                   -- Legacy/alternate format
                                   "function "..descrambler.."%([^)]*%){(.-)}" )
     if not rules then
@@ -139,7 +139,7 @@ function js_descramble( sig, js_url )
 
     -- Fetch the helper object code
     -- var Fo={TR:function(a){a.reverse()},TU:function(a,b){var c=a[0];a[0]=a[b%a.length];a[b]=c},sH:function(a,b){a.splice(0,b)}};
-    local transformations = js_extract( js, "var "..helper.."={(.-)};", nil )
+    local transformations = js_extract( js, "[ ,]"..helper.."={(.-)};", nil )
     if not transformations then
         return sig
     end



More information about the vlc-commits mailing list