diff options
author | bashonly <88596187+bashonly@users.noreply.github.com> | 2024-09-26 18:21:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 23:21:03 +0000 |
commit | 9f5c9a90898c5a1e672922d9cd799716c73cee34 (patch) | |
tree | 5d8b2665b5e7b74318b5551caf50d5fcd1accfd5 | |
parent | a2000bc85730c950351d78bb818493dc39dca3cb (diff) |
[ie/wistia] Support password-protected videos (#11100)
Closes #10914
Authored by: bashonly
-rw-r--r-- | yt_dlp/extractor/wistia.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/yt_dlp/extractor/wistia.py b/yt_dlp/extractor/wistia.py index fb2a8648f..df7ecb3cd 100644 --- a/yt_dlp/extractor/wistia.py +++ b/yt_dlp/extractor/wistia.py @@ -8,6 +8,7 @@ from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, determine_ext, + filter_dict, float_or_none, int_or_none, parse_qs, @@ -25,16 +26,25 @@ class WistiaBaseIE(InfoExtractor): def _download_embed_config(self, config_type, config_id, referer): base_url = self._EMBED_BASE_URL + f'{config_type}/{config_id}' + video_password = self.get_param('videopassword') embed_config = self._download_json( base_url + '.json', config_id, headers={ 'Referer': referer if referer.startswith('http') else base_url, # Some videos require this. - }) + }, query=filter_dict({'password': video_password})) error = traverse_obj(embed_config, 'error') if error: raise ExtractorError( f'Error while getting the playlist: {error}', expected=True) + if traverse_obj(embed_config, ( + 'media', ('embed_options', 'embedOptions'), 'plugin', + 'passwordProtectedVideo', 'on', any)) == 'true': + if video_password: + raise ExtractorError('Invalid video password', expected=True) + raise ExtractorError( + 'This content is password-protected. Use the --video-password option', expected=True) + return embed_config def _get_real_ext(self, url): |