mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-03-23 18:22:09 +01:00
[ie/youtube] Always respect webpage_client extractor-arg (#16250)
Authored by: bashonly
This commit is contained in:
@@ -1896,6 +1896,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
def _player_js_version(self):
|
def _player_js_version(self):
|
||||||
return self._configuration_arg('player_js_version', [None])[0] or self._DEFAULT_PLAYER_JS_VERSION
|
return self._configuration_arg('player_js_version', [None])[0] or self._DEFAULT_PLAYER_JS_VERSION
|
||||||
|
|
||||||
|
@functools.cached_property
|
||||||
|
def _webpage_client(self):
|
||||||
|
webpage_client = self._configuration_arg('webpage_client', [self._DEFAULT_WEBPAGE_CLIENT])[0]
|
||||||
|
if webpage_client not in self._WEBPAGE_CLIENTS:
|
||||||
|
self.report_warning(
|
||||||
|
f'Invalid webpage_client "{webpage_client}" requested; '
|
||||||
|
f'falling back to {self._DEFAULT_WEBPAGE_CLIENT}', only_once=True)
|
||||||
|
webpage_client = self._DEFAULT_WEBPAGE_CLIENT
|
||||||
|
return webpage_client
|
||||||
|
|
||||||
@functools.cached_property
|
@functools.cached_property
|
||||||
def _skipped_webpage_data(self):
|
def _skipped_webpage_data(self):
|
||||||
skipped = set(self._configuration_arg('webpage_skip'))
|
skipped = set(self._configuration_arg('webpage_skip'))
|
||||||
@@ -1935,7 +1945,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
return
|
return
|
||||||
|
|
||||||
_, _, _, _, prs, player_url = self._initial_extract(
|
_, _, _, _, prs, player_url = self._initial_extract(
|
||||||
url, smuggled_data, webpage_url, 'web', video_id)
|
url, smuggled_data, webpage_url, self._webpage_client, video_id)
|
||||||
video_details = traverse_obj(prs, (..., 'videoDetails'), expected_type=dict)
|
video_details = traverse_obj(prs, (..., 'videoDetails'), expected_type=dict)
|
||||||
microformats = traverse_obj(
|
microformats = traverse_obj(
|
||||||
prs, (..., 'microformat', 'playerMicroformatRenderer'),
|
prs, (..., 'microformat', 'playerMicroformatRenderer'),
|
||||||
@@ -3902,15 +3912,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
|
|
||||||
base_url = self.http_scheme() + '//www.youtube.com/'
|
base_url = self.http_scheme() + '//www.youtube.com/'
|
||||||
webpage_url = base_url + 'watch?v=' + video_id
|
webpage_url = base_url + 'watch?v=' + video_id
|
||||||
webpage_client = self._configuration_arg('webpage_client', [self._DEFAULT_WEBPAGE_CLIENT])[0]
|
|
||||||
if webpage_client not in self._WEBPAGE_CLIENTS:
|
|
||||||
self.report_warning(
|
|
||||||
f'Invalid webpage_client "{webpage_client}" requested; '
|
|
||||||
f'falling back to {self._DEFAULT_WEBPAGE_CLIENT}', only_once=True)
|
|
||||||
webpage_client = self._DEFAULT_WEBPAGE_CLIENT
|
|
||||||
|
|
||||||
webpage, webpage_ytcfg, initial_data, is_premium_subscriber, player_responses, player_url = self._initial_extract(
|
webpage, webpage_ytcfg, initial_data, is_premium_subscriber, player_responses, player_url = self._initial_extract(
|
||||||
url, smuggled_data, webpage_url, webpage_client, video_id)
|
url, smuggled_data, webpage_url, self._webpage_client, video_id)
|
||||||
|
|
||||||
playability_statuses = traverse_obj(
|
playability_statuses = traverse_obj(
|
||||||
player_responses, (..., 'playabilityStatus'), expected_type=dict)
|
player_responses, (..., 'playabilityStatus'), expected_type=dict)
|
||||||
|
|||||||
Reference in New Issue
Block a user