@ -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