diff options
author | Damiano Amatruda <damiano.amatruda@outlook.com> | 2022-12-29 07:54:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-29 12:24:19 +0530 |
commit | a4d6ead30fde0e85eb34859e86c707621e38f8a1 (patch) | |
tree | 655e760c00b14d6e6124a531933bd3e38de47dd2 /yt_dlp/extractor/ciscowebex.py | |
parent | d1b5f3d79cb33f393f17aa12df24fca33c7ef3aa (diff) | |
download | hypervideo-pre-a4d6ead30fde0e85eb34859e86c707621e38f8a1.tar.lz hypervideo-pre-a4d6ead30fde0e85eb34859e86c707621e38f8a1.tar.xz hypervideo-pre-a4d6ead30fde0e85eb34859e86c707621e38f8a1.zip |
[extractor/ciscowebex] Support password-protected videos (#5601)
Authored by: damianoamatruda
Diffstat (limited to 'yt_dlp/extractor/ciscowebex.py')
-rw-r--r-- | yt_dlp/extractor/ciscowebex.py | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/yt_dlp/extractor/ciscowebex.py b/yt_dlp/extractor/ciscowebex.py index 44595d854..0fcf02282 100644 --- a/yt_dlp/extractor/ciscowebex.py +++ b/yt_dlp/extractor/ciscowebex.py @@ -1,5 +1,6 @@ from .common import InfoExtractor from ..utils import ( + ExtractorError, int_or_none, try_get, unified_timestamp, @@ -38,11 +39,30 @@ class CiscoWebexIE(InfoExtractor): siteurl = mobj.group('siteurl_1') or mobj.group('siteurl_2') video_id = mobj.group('id') - stream = self._download_json( + password = self.get_param('videopassword') + + headers = {'Accept': 'application/json'} + if password: + headers['accessPwd'] = password + + stream, urlh = self._download_json_handle( 'https://%s.webex.com/webappng/api/v1/recordings/%s/stream' % (subdomain, video_id), - video_id, fatal=False, query={'siteurl': siteurl}) - if not stream: - self.raise_login_required(method='cookies') + video_id, headers=headers, query={'siteurl': siteurl}, expected_status=(403, 429)) + + if urlh.status == 403: + if stream['code'] == 53004: + self.raise_login_required() + if stream['code'] == 53005: + if password: + raise ExtractorError('Wrong password', expected=True) + raise ExtractorError( + 'This video is protected by a password, use the --video-password option', expected=True) + raise ExtractorError(f'{self.IE_NAME} said: {stream["code"]} - {stream["message"]}', expected=True) + + if urlh.status == 429: + self.raise_login_required( + f'{self.IE_NAME} asks you to solve a CAPTCHA. Solve CAPTCHA in browser and', + method='cookies') video_id = stream.get('recordUUID') or video_id @@ -78,7 +98,7 @@ class CiscoWebexIE(InfoExtractor): 'title': stream['recordName'], 'description': stream.get('description'), 'uploader': stream.get('ownerDisplayName'), - 'uploader_id': stream.get('ownerUserName') or stream.get('ownerId'), # mail or id + 'uploader_id': stream.get('ownerUserName') or stream.get('ownerId'), 'timestamp': unified_timestamp(stream.get('createTime')), 'duration': int_or_none(stream.get('duration'), 1000), 'webpage_url': 'https://%s.webex.com/recordingservice/sites/%s/recording/playback/%s' % (subdomain, siteurl, video_id), |