Browse Source

youtube.lua: fix up signature descrambling function name extraction

Javascript variables can contain other, special characters, also %a
depends on the locale.

(cherry picked from commit a178691270)
Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
pull/135/head
Pierre Ynard 5 years ago
committed by Hugo Beauzée-Luyssen
parent
commit
773f23dd29
  1. 4
      share/lua/playlist/youtube.lua

4
share/lua/playlist/youtube.lua

@ -123,13 +123,11 @@ function js_descramble( sig, js_url )
end
-- Look for the descrambler function's name
-- if(k.s){var l=k.sp,m=pt(decodeURIComponent(k.s));f.set(l,encodeURIComponent(m))}
-- Descrambler function name - 3 chars length
-- if(h.s){var l=h.sp,m=wja(decodeURIComponent(h.s));f.set(l,encodeURIComponent(m))}
-- k.s (from stream map field "s") holds the input scrambled signature
-- k.sp (from stream map field "sp") holds a parameter name (normally
-- "signature" or "sig") to set with the output, descrambled signature
local descrambler = js_extract( js, "[=%(,&|](%a?%a?%a?)%(decodeURIComponent%(.%.s%)%)" )
local descrambler = js_extract( js, "[=%(,&|](...?)%(decodeURIComponent%(.%.s%)%)" )
if not descrambler then
vlc.msg.dbg( "Couldn't extract youtube video URL signature descrambling function name" )
return sig

Loading…
Cancel
Save