mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-04-03 02:54:14 +00:00
[YouTube] Improve support for tce-style player JS
* improve extraction of global "useful data" Array from player JS * also handle tv-player and add tests: thx seproDev (yt-dlp/yt-dlp#12684) Co-Authored-By: sepro <sepro@sepr0.com>
This commit is contained in:
parent
37c2440d6a
commit
da7223d4aa
@ -232,8 +232,32 @@ _NSIG_TESTS = [
|
|||||||
'W9HJZKktxuYoDTqW', 'jHbbkcaxm54',
|
'W9HJZKktxuYoDTqW', 'jHbbkcaxm54',
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'https://www.youtube.com/s/player/91201489/player_ias_tce.vflset/en_US/base.js',
|
'https://www.youtube.com/s/player/643afba4/player_ias.vflset/en_US/base.js',
|
||||||
'W9HJZKktxuYoDTqW', 'U48vOZHaeYS6vO',
|
'W9HJZKktxuYoDTqW', 'larxUlagTRAcSw',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/e7567ecf/player_ias_tce.vflset/en_US/base.js',
|
||||||
|
'Sy4aDGc0VpYRR9ew_', '5UPOT1VhoZxNLQ',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/d50f54ef/player_ias_tce.vflset/en_US/base.js',
|
||||||
|
'Ha7507LzRmH3Utygtj', 'XFTb2HoeOE5MHg',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/074a8365/player_ias_tce.vflset/en_US/base.js',
|
||||||
|
'Ha7507LzRmH3Utygtj', 'ufTsrE0IVYrkl8v',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/643afba4/player_ias.vflset/en_US/base.js',
|
||||||
|
'N5uAlLqm0eg1GyHO', 'dCBQOejdq5s-ww',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/69f581a5/tv-player-ias.vflset/tv-player-ias.js',
|
||||||
|
'-qIP447rVlTTwaZjY', 'KNcGOksBAvwqQg',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/643afba4/tv-player-ias.vflset/tv-player-ias.js',
|
||||||
|
'ir9-V6cdbCiyKxhr', '2PL7ZDYAALMfmA',
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -692,7 +692,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
'invidious': '|'.join(_INVIDIOUS_SITES),
|
'invidious': '|'.join(_INVIDIOUS_SITES),
|
||||||
}
|
}
|
||||||
_PLAYER_INFO_RE = (
|
_PLAYER_INFO_RE = (
|
||||||
r'/s/player/(?P<id>[a-zA-Z0-9_-]{8,})/player',
|
r'/s/player/(?P<id>[a-zA-Z0-9_-]{8,})//(?:tv-)?player',
|
||||||
r'/(?P<id>[a-zA-Z0-9_-]{8,})/player(?:_ias\.vflset(?:/[a-zA-Z]{2,3}_[a-zA-Z]{2,3})?|-plasma-ias-(?:phone|tablet)-[a-z]{2}_[A-Z]{2}\.vflset)/base\.js$',
|
r'/(?P<id>[a-zA-Z0-9_-]{8,})/player(?:_ias\.vflset(?:/[a-zA-Z]{2,3}_[a-zA-Z]{2,3})?|-plasma-ias-(?:phone|tablet)-[a-z]{2}_[A-Z]{2}\.vflset)/base\.js$',
|
||||||
r'\b(?P<id>vfl[a-zA-Z0-9_-]+)\b.*?\.js$',
|
r'\b(?P<id>vfl[a-zA-Z0-9_-]+)\b.*?\.js$',
|
||||||
)
|
)
|
||||||
@ -1857,7 +1857,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
def _extract_n_function_code_jsi(self, video_id, jsi, player_id=None):
|
def _extract_n_function_code_jsi(self, video_id, jsi, player_id=None):
|
||||||
|
|
||||||
var_ay = self._search_regex(
|
var_ay = self._search_regex(
|
||||||
r'(?:[;\s]|^)\s*(var\s*[\w$]+\s*=\s*"[^"]+"\s*\.\s*split\("\{"\))(?=\s*[,;])',
|
r'(?:[;\s]|^)\s*(var\s*[\w$]+\s*=\s*"(?:\\"|[^"])+"\s*\.\s*split\("\W+"\))(?=\s*[,;])',
|
||||||
jsi.code, 'useful values', default='')
|
jsi.code, 'useful values', default='')
|
||||||
|
|
||||||
func_name = self._extract_n_function_name(jsi.code)
|
func_name = self._extract_n_function_name(jsi.code)
|
||||||
|
Loading…
Reference in New Issue
Block a user