[vlc-commits] youtube.lua: remove alternate patterns for signature descrambling javascript

Pierre Ynard git at videolan.org
Mon Oct 24 08:19:49 CEST 2016


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Mon Oct 24 08:03:17 2016 +0200| [fe779d52036ae21f518bec6cc65d7dddb62fa290] | committer: Pierre Ynard

youtube.lua: remove alternate patterns for signature descrambling javascript

This isn't actually helpful in practice.

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

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

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 0bbf97c..7ecf3d1 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -84,13 +84,10 @@ function buf_iter( s )
 end
 
 -- Helper to search and extract code from javascript stream
-function js_extract( js, pattern, alt )
+function js_extract( js, pattern )
     js.i = 0 -- Reset to beginning
     for line in buf_iter, js do
         local ex = string.match( line, pattern )
-        if not ex and alt then
-            ex = string.match( line, alt )
-        end
         if ex then
             return ex
         end
@@ -111,7 +108,7 @@ function js_descramble( sig, js_url )
 
     -- Look for the descrambler function's name
     -- c&&a.set("signature",br(c));
-    local descrambler = js_extract( js, "%.set%(\"signature\",(.-)%(", nil )
+    local descrambler = js_extract( js, "%.set%(\"signature\",(.-)%(" )
     if not descrambler then
         vlc.msg.dbg( "Couldn't extract youtube video URL signature descrambling function name" )
         return sig
@@ -119,9 +116,7 @@ function js_descramble( sig, js_url )
 
     -- Fetch the code of the descrambler function
     -- 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, "^"..descrambler.."=function%([^)]*%){(.-)};",
-                                  -- Legacy/alternate format
-                                  "function "..descrambler.."%([^)]*%){(.-)}" )
+    local rules = js_extract( js, "^"..descrambler.."=function%([^)]*%){(.-)};" )
     if not rules then
         vlc.msg.dbg( "Couldn't extract youtube video URL signature descrambling rules" )
         return sig
@@ -137,7 +132,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, "[ ,]"..helper.."={(.-)};", nil )
+    local transformations = js_extract( js, "[ ,]"..helper.."={(.-)};" )
     if not transformations then
         vlc.msg.dbg( "Couldn't extract youtube video URL signature transformation code" )
         return sig



More information about the vlc-commits mailing list