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

Pierre Ynard git at videolan.org
Sat Dec 19 17:48:57 CET 2015


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Dec 19 17:45:55 2015 +0100| [623c46ba4ded47624ae4f840b58e8c1227325c74] | committer: Pierre Ynard

youtube.lua: more flexible variable declaration parsing in javascript

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

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

 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 7089960..f048141 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -112,7 +112,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
@@ -128,7 +128,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