Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC


Commits:
2c31361c by Pierre Ynard at 2022-03-08T10:03:32+00:00
youtube.lua: update "n" descrambling function name parsing

The descrambling function is now called through an intermediate array
variable. This change has also added two extra ways to recover the
function name. Add support to parse and resolve any of them.

Fixes #26574

(cherry picked from commit 3df28fc51ef2ea46084aef1785ded18afa31ef9e)
Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org>

- - - - -


1 changed file:

- share/lua/playlist/youtube.lua


Changes:

=====================================
share/lua/playlist/youtube.lua
=====================================
@@ -1,7 +1,7 @@
 --[[
  $Id$
 
- Copyright © 2007-2021 the VideoLAN team
+ Copyright © 2007-2022 the VideoLAN team
 
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
@@ -119,8 +119,37 @@ function n_descramble( nparam, js )
     end
 
     -- Look for the descrambler function's name
-    -- a.D&&(b=a.get("n"))&&(b=lha(b),a.set("n",b))}};
-    local descrambler = js_extract( js, '[=%(,&|](...?)%(.%),.%.set%("n",' )
+    -- a.C&&(b=a.get("n"))&&(b=Bpa[0](b),a.set("n",b),Bpa.length||iha(""))}};
+    -- var Bpa=[iha];
+    local callsite = js_extract( js, '[^;]*%.set%("n",[^};]*' )
+    if not callsite then
+        vlc.msg.dbg( "Couldn't extract YouTube video throttling parameter 
descrambling function name" )
+        return nil
+    end
+
+    -- Try direct function name from following clause
+    local descrambler = string.match( callsite, 
'%.set%("n",.%),...?%.length||(...?)%(' )
+    local itm = nil
+    if not descrambler then
+        -- Try from main call site
+        descrambler = string.match( callsite, 
'[=%(,&|]([a-zA-Z0-9_$%[%]]+)%(.%),.%.set%("n",' )
+        if descrambler then
+            -- Check if this is only an intermediate variable
+            itm = string.match( descrambler, '^([^%[%]]+)%[' )
+            if itm then
+                descrambler = nil
+            end
+        else
+            -- Last chance: intermediate variable in following clause
+            itm = string.match( callsite, '%.set%("n",.%),(...?)%.length' )
+        end
+    end
+
+    if not descrambler and itm then
+        -- Resolve intermediate variable
+        descrambler = js_extract( js, 'var '..itm..'=%[(...?)[%],]' )
+    end
+
     if not descrambler then
         vlc.msg.dbg( "Couldn't extract YouTube video throttling parameter 
descrambling function name" )
         return nil



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/2c31361c347b0f31b6818a28d4fe94f9543aad56

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/2c31361c347b0f31b6818a28d4fe94f9543aad56
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to