diff options
author | coletdjnz <coletdjnz@protonmail.com> | 2023-07-29 18:20:42 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-29 06:20:42 +0000 |
commit | ba06d77a316650ff057347d224b5afa8b203ad65 (patch) | |
tree | a8ae58e562ae9408a7f019e1ad42741568a98f5d /yt_dlp | |
parent | 4bf912282a34b58b6b35d8f7e6be535770c89c76 (diff) | |
download | hypervideo-pre-ba06d77a316650ff057347d224b5afa8b203ad65.tar.lz hypervideo-pre-ba06d77a316650ff057347d224b5afa8b203ad65.tar.xz hypervideo-pre-ba06d77a316650ff057347d224b5afa8b203ad65.zip |
[ie/youtube] Add `player_params` extractor arg (#7719)
Authored by: coletdjnz
Diffstat (limited to 'yt_dlp')
-rw-r--r-- | yt_dlp/extractor/youtube.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 2b3776aa1..940a4995b 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -3583,8 +3583,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor): def _is_unplayable(player_response): return traverse_obj(player_response, ('playabilityStatus', 'status')) == 'UNPLAYABLE' - _PLAYER_PARAMS = 'CgIQBg==' - def _extract_player_response(self, client, video_id, master_ytcfg, player_ytcfg, player_url, initial_pr, smuggled_data): session_index = self._extract_session_index(player_ytcfg, master_ytcfg) @@ -3597,7 +3595,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor): 'videoId': video_id, } if _split_innertube_client(client)[0] == 'android': - yt_query['params'] = self._PLAYER_PARAMS + yt_query['params'] = 'CgIQBg==' + + pp_arg = self._configuration_arg('player_params', [None])[0] + if pp_arg: + yt_query['params'] = pp_arg yt_query.update(self._generate_player_context(sts)) return self._extract_response( @@ -4016,6 +4018,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor): webpage = None if 'webpage' not in self._configuration_arg('player_skip'): query = {'bpctr': '9999999999', 'has_verified': '1'} + pp = self._configuration_arg('player_params', [None])[0] + if pp: + query['pp'] = pp webpage = self._download_webpage( webpage_url, video_id, fatal=False, query=query) |