1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-20 01:42:50 +01:00

[extractor/youtube] Workaround 403 for android formats

Ref: https://github.com/TeamNewPipe/NewPipe/issues/9038#issuecomment-1289756816
This commit is contained in:
pukkandan 2023-06-22 00:15:22 +05:30
parent a4486bfc1d
commit 81ca451480
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39

View File

@ -3599,7 +3599,7 @@ def _is_agegated(player_response):
def _is_unplayable(player_response): def _is_unplayable(player_response):
return traverse_obj(player_response, ('playabilityStatus', 'status')) == 'UNPLAYABLE' return traverse_obj(player_response, ('playabilityStatus', 'status')) == 'UNPLAYABLE'
_STORY_PLAYER_PARAMS = '8AEB' _PLAYER_PARAMS = 'CgIQBg=='
def _extract_player_response(self, client, video_id, master_ytcfg, player_ytcfg, player_url, initial_pr, smuggled_data): def _extract_player_response(self, client, video_id, master_ytcfg, player_ytcfg, player_url, initial_pr, smuggled_data):
@ -3613,7 +3613,7 @@ def _extract_player_response(self, client, video_id, master_ytcfg, player_ytcfg,
'videoId': video_id, 'videoId': video_id,
} }
if smuggled_data.get('is_story') or _split_innertube_client(client)[0] == 'android': if smuggled_data.get('is_story') or _split_innertube_client(client)[0] == 'android':
yt_query['params'] = self._STORY_PLAYER_PARAMS yt_query['params'] = self._PLAYER_PARAMS
yt_query.update(self._generate_player_context(sts)) yt_query.update(self._generate_player_context(sts))
return self._extract_response( return self._extract_response(
@ -4011,8 +4011,8 @@ def _download_player_responses(self, url, smuggled_data, video_id, webpage_url):
webpage = None webpage = None
if 'webpage' not in self._configuration_arg('player_skip'): if 'webpage' not in self._configuration_arg('player_skip'):
query = {'bpctr': '9999999999', 'has_verified': '1'} query = {'bpctr': '9999999999', 'has_verified': '1'}
if smuggled_data.get('is_story'): if smuggled_data.get('is_story'): # XXX: Deprecated
query['pp'] = self._STORY_PLAYER_PARAMS query['pp'] = self._PLAYER_PARAMS
webpage = self._download_webpage( webpage = self._download_webpage(
webpage_url, video_id, fatal=False, query=query) webpage_url, video_id, fatal=False, query=query)