[vlc-commits] youtube.lua: handle inlined function in descrambling javascript

Pierre Ynard git at videolan.org
Mon Dec 9 19:39:37 CET 2013


vlc/vlc-2.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Sep 22 04:29:47 2013 +0200| [6e39f75da2ee2919975fa086e189558ae06a5204] | committer: Felix Paul Kühne

youtube.lua: handle inlined function in descrambling javascript

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

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=6e39f75da2ee2919975fa086e189558ae06a5204
---

 share/lua/playlist/youtube.lua |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 5778adb..30da2f8 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -128,6 +128,12 @@ function js_descramble( sig, js_url )
         -- characters:
         -- function jj(a,b){var c=a[0];a[0]=a[b%a.length];a[b]=c;return a}
         local idx = string.match( rule, "=..%([^,]+,(%d+)%)" )
+        -- This swapping function may also appear inlined:
+        -- var b=a[0];a[0]=a[59%a.length];a[59]=b;
+        -- In that case we only catch one of the three rules.
+        if not idx then
+            idx = string.match( rule, ".%[(%d+)%]=." )
+        end
         if idx then
             idx = tonumber( idx )
             if not idx then idx = 0 end



More information about the vlc-commits mailing list