[youtube] Fix n-sig extraction for phone player JS (#2816)

Authored by: MinePlayersPE
This commit is contained in:
MinePlayersPE 2022-02-18 15:12:20 +07:00 committed by GitHub
parent 5b804e3906
commit c571b3a6ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -90,6 +90,10 @@ _NSIG_TESTS = [
'https://www.youtube.com/s/player/e06dea74/player_ias.vflset/en_US/base.js', 'https://www.youtube.com/s/player/e06dea74/player_ias.vflset/en_US/base.js',
'AiuodmaDDYw8d3y4bf', 'ankd8eza2T6Qmw', 'AiuodmaDDYw8d3y4bf', 'ankd8eza2T6Qmw',
), ),
(
'https://www.youtube.com/s/player/5dd88d1d/player-plasma-ias-phone-en_US.vflset/base.js',
'kSxKFLeqzv_ZyHSAt', 'n8gS8oRlHOxPFA',
),
] ]

View File

@ -2413,7 +2413,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
def _extract_n_function_name(self, jscode): def _extract_n_function_name(self, jscode):
nfunc, idx = self._search_regex( nfunc, idx = self._search_regex(
r'\.get\("n"\)\)&&\(b=(?P<nfunc>[a-zA-Z0-9$]{3})(?:\[(?P<idx>\d+)\])?\([a-zA-Z0-9]\)', r'\.get\("n"\)\)&&\(b=(?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 nfunc return nfunc