mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-05-01 00:08:47 +02:00
Compare commits
2 Commits
9d5e6de2e7
...
4054a2b623
Author | SHA1 | Date | |
---|---|---|---|
|
4054a2b623 | ||
|
b9c979461b |
@ -83,6 +83,11 @@ _SIG_TESTS = [
|
||||
'2aq0aqSyOoJXtK73m-uME_jv7-pT15gOFC02RFkGMqWpzEICs69VdbwQ0LDp1v7j8xx92efCJlYFYb1sUkkBSPOlPmXgIARw8JQ0qOAOAA',
|
||||
'AAOAOq0QJ8wRAIgXmPlOPSBkkUs1bYFYlJCfe29xx8j7vgpDL0QwbdV06sCIEzpWqMGkFR20CFOS21Tp-7vj_EMu-m37KtXJoOy1',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/363db69b/player_ias.vflset/en_US/base.js',
|
||||
'2aq0aqSyOoJXtK73m-uME_jv7-pT15gOFC02RFkGMqWpzEICs69VdbwQ0LDp1v7j8xx92efCJlYFYb1sUkkBSPOlPmXgIARw8JQ0qOAOAA',
|
||||
'0aqSyOoJXtK73m-uME_jv7-pT15gOFC02RFkGMqWpz2ICs6EVdbwQ0LDp1v7j8xx92efCJlYFYb1sUkkBSPOlPmXgIARw8JQ0qOAOAA',
|
||||
),
|
||||
]
|
||||
|
||||
_NSIG_TESTS = [
|
||||
@ -234,6 +239,10 @@ _NSIG_TESTS = [
|
||||
'https://www.youtube.com/s/player/643afba4/tv-player-ias.vflset/tv-player-ias.js',
|
||||
'ir9-V6cdbCiyKxhr', '2PL7ZDYAALMfmA',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/363db69b/player_ias.vflset/en_US/base.js',
|
||||
'eWYu5d5YeY_4LyEDc', 'XJQqf-N7Xra3gg',
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
@ -2176,10 +2176,13 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
"""Returns tuple of strings: variable assignment code, variable name, variable value code"""
|
||||
return self._search_regex(
|
||||
r'''(?x)
|
||||
\'use\s+strict\';\s*
|
||||
(?P<q1>["\'])use\s+strict(?P=q1);\s*
|
||||
(?P<code>
|
||||
var\s+(?P<name>[a-zA-Z0-9_$]+)\s*=\s*
|
||||
(?P<value>"(?:[^"\\]|\\.)+"\.split\("[^"]+"\))
|
||||
(?P<value>
|
||||
(?P<q2>["\'])(?:(?!(?P=q2)).|\\.)+(?P=q2)
|
||||
\.split\((?P<q3>["\'])(?:(?!(?P=q3)).)+(?P=q3)\)
|
||||
)
|
||||
)[;,]
|
||||
''', jscode, 'global variable', group=('code', 'name', 'value'), default=(None, None, None))
|
||||
|
||||
@ -2187,7 +2190,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
global_var, varname, _ = self._extract_player_js_global_var(full_code)
|
||||
if global_var:
|
||||
self.write_debug(f'Prepending n function code with global array variable "{varname}"')
|
||||
code = global_var + ', ' + code
|
||||
code = global_var + '; ' + code
|
||||
else:
|
||||
self.write_debug('No global array variable found in player JS')
|
||||
return argnames, re.sub(
|
||||
@ -2196,7 +2199,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
|
||||
def _extract_n_function_code(self, video_id, player_url):
|
||||
player_id = self._extract_player_info(player_url)
|
||||
func_code = self.cache.load('youtube-nsig', player_id, min_ver='2025.03.21')
|
||||
func_code = self.cache.load('youtube-nsig', player_id, min_ver='2025.03.24')
|
||||
jscode = func_code or self._load_player(video_id, player_url)
|
||||
jsi = JSInterpreter(jscode)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user