mirror of https://github.com/yt-dlp/yt-dlp.git
[ie/youtube] Fix JS `n` function name extraction (#10390)
Fixes nsig decoding for player b22ef6e7 Closes #10391 Authored by: bashonly, seproDev Co-authored-by: sepro <4618135+seproDev@users.noreply.github.com>
This commit is contained in:
parent
6c056ea7ae
commit
297b0a3792
|
@ -167,6 +167,10 @@ _NSIG_TESTS = [
|
||||||
'https://www.youtube.com/s/player/590f65a6/player_ias.vflset/en_US/base.js',
|
'https://www.youtube.com/s/player/590f65a6/player_ias.vflset/en_US/base.js',
|
||||||
'1tm7-g_A9zsI8_Lay_', 'xI4Vem4Put_rOg',
|
'1tm7-g_A9zsI8_Lay_', 'xI4Vem4Put_rOg',
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/b22ef6e7/player_ias.vflset/en_US/base.js',
|
||||||
|
'b6HcntHGkvBLk_FRf', 'kNPW6A7FyP2l8A',
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3130,7 +3130,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
|
|
||||||
def _extract_n_function_name(self, jscode):
|
def _extract_n_function_name(self, jscode):
|
||||||
funcname, idx = self._search_regex(
|
funcname, idx = self._search_regex(
|
||||||
r'\.get\("n"\)\)&&\(b=(?P<nfunc>[a-zA-Z0-9$]+)(?:\[(?P<idx>\d+)\])?\([a-zA-Z0-9]\)',
|
r'''(?x)(?:\.get\("n"\)\)&&\(b=|b=String\.fromCharCode\(110\),c=a\.get\(b\)\)&&\(c=)
|
||||||
|
(?P<nfunc>[a-zA-Z0-9$]+)(?:\[(?P<idx>\d+)\])?\([a-zA-Z0-9]\)''',
|
||||||
jscode, 'Initial JS player n function name', group=('nfunc', 'idx'))
|
jscode, 'Initial JS player n function name', group=('nfunc', 'idx'))
|
||||||
if not idx:
|
if not idx:
|
||||||
return funcname
|
return funcname
|
||||||
|
|
Loading…
Reference in New Issue