]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/zoom.py
1 from .common
import InfoExtractor
14 class ZoomIE(InfoExtractor
):
16 _VALID_URL
= r
'(?P<base_url>https?://(?:[^.]+\.)?zoom.us/)rec(?:ording)?/(?P<type>play|share)/(?P<id>[A-Za-z0-9_.-]+)'
18 'url': 'https://economist.zoom.us/rec/play/dUk_CNBETmZ5VA2BwEl-jjakPpJ3M1pcfVYAPRsoIbEByGsLjUZtaa4yCATQuOL3der8BlTwxQePl_j0.EImBkXzTIaPvdZO5',
19 'md5': 'ab445e8c911fddc4f9adc842c2c5d434',
21 'id': 'dUk_CNBETmZ5VA2BwEl-jjakPpJ3M1pcfVYAPRsoIbEByGsLjUZtaa4yCATQuOL3der8BlTwxQePl_j0.EImBkXzTIaPvdZO5',
23 'title': 'China\'s "two sessions" and the new five-year plan',
25 'skip': 'Recording requires email authentication to access',
28 'url': 'https://ffgolf.zoom.us/rec/play/qhEhXbrxq1Zoucx8CMtHzq1Z_2YZRPVCqWK_K-2FkEGRsSLDeOX8Tu4P6jtjZcRry8QhIbvKZdtr4UNo.QcPn2debFskI9whJ',
29 'md5': '2c4b1c4e5213ebf9db293e88d9385bee',
31 'id': 'qhEhXbrxq1Zoucx8CMtHzq1Z_2YZRPVCqWK_K-2FkEGRsSLDeOX8Tu4P6jtjZcRry8QhIbvKZdtr4UNo.QcPn2debFskI9whJ',
33 'title': 'Prépa AF2023 - Séance 5 du 11 avril - R20/VM/GO',
37 'url': 'https://us02web.zoom.us/rec/share/hkUk5Zxcga0nkyNGhVCRfzkA2gX_mzgS3LpTxEEWJz9Y_QpIQ4mZFOUx7KZRZDQA.9LGQBdqmDAYgiZ_8',
38 'md5': '90fdc7cfcaee5d52d1c817fc03c43c9b',
40 'id': 'hkUk5Zxcga0nkyNGhVCRfzkA2gX_mzgS3LpTxEEWJz9Y_QpIQ4mZFOUx7KZRZDQA.9LGQBdqmDAYgiZ_8',
42 'title': 'Timea Andrea Lelik\'s Personal Meeting Room',
46 def _get_page_data(self
, webpage
, video_id
):
47 return self
._search
_json
(
48 r
'window\.__data__\s*=', webpage
, 'data', video_id
, transform_source
=js_to_json
)
50 def _get_real_webpage(self
, url
, base_url
, video_id
, url_type
):
51 webpage
= self
._download
_webpage
(url
, video_id
, note
=f
'Downloading {url_type} webpage')
53 form
= self
._form
_hidden
_inputs
('password_form', webpage
)
54 except ExtractorError
:
57 password
= self
.get_param('videopassword')
60 'This video is protected by a passcode, use the --video-password option', expected
=True)
61 is_meeting
= form
.get('useWhichPasswd') == 'meeting'
62 validation
= self
._download
_json
(
63 base_url
+ 'rec/validate%s_passwd' % ('_meet' if is_meeting
else ''),
64 video_id
, 'Validating passcode', 'Wrong passcode', data
=urlencode_postdata({
65 'id': form
[('meet' if is_meeting
else 'file') + 'Id'],
67 'action': form
.get('action'),
69 if not validation
.get('status'):
70 raise ExtractorError(validation
['errorMessage'], expected
=True)
71 return self
._download
_webpage
(url
, video_id
, note
=f
'Re-downloading {url_type} webpage')
73 def _real_extract(self
, url
):
74 base_url
, url_type
, video_id
= self
._match
_valid
_url
(url
).group('base_url', 'type', 'id')
76 if url_type
== 'share':
77 webpage
= self
._get
_real
_webpage
(url
, base_url
, video_id
, 'share')
78 meeting_id
= self
._get
_page
_data
(webpage
, video_id
)['meetingId']
79 redirect_path
= self
._download
_json
(
80 f
'{base_url}nws/recording/1.0/play/share-info/{meeting_id}',
81 video_id
, note
='Downloading share info JSON')['result']['redirectUrl']
82 url
= urljoin(base_url
, redirect_path
)
84 webpage
= self
._get
_real
_webpage
(url
, base_url
, video_id
, 'play')
85 file_id
= self
._get
_page
_data
(webpage
, video_id
)['fileId']
87 # When things go wrong, file_id can be empty string
88 raise ExtractorError('Unable to extract file ID')
90 data
= self
._download
_json
(
91 f
'{base_url}nws/recording/1.0/play/info/{file_id}', video_id
,
92 note
='Downloading play info JSON')['result']
95 for _type
in ('transcript', 'cc', 'chapter'):
96 if data
.get('%sUrl' % _type
):
98 'url': urljoin(base_url
, data
['%sUrl' % _type
]),
104 if data
.get('viewMp4Url'):
106 'format_note': 'Camera stream',
107 'url': str_or_none(data
.get('viewMp4Url')),
108 'width': int_or_none(traverse_obj(data
, ('viewResolvtions', 0))),
109 'height': int_or_none(traverse_obj(data
, ('viewResolvtions', 1))),
110 'format_id': str_or_none(traverse_obj(data
, ('recording', 'id'))),
112 'filesize_approx': parse_filesize(str_or_none(traverse_obj(data
, ('recording', 'fileSizeInMB')))),
116 if data
.get('shareMp4Url'):
118 'format_note': 'Screen share stream',
119 'url': str_or_none(data
.get('shareMp4Url')),
120 'width': int_or_none(traverse_obj(data
, ('shareResolvtions', 0))),
121 'height': int_or_none(traverse_obj(data
, ('shareResolvtions', 1))),
122 'format_id': str_or_none(traverse_obj(data
, ('shareVideo', 'id'))),
129 'title': str_or_none(traverse_obj(data
, ('meet', 'topic'))),
130 'duration': int_or_none(data
.get('duration')),
131 'subtitles': subtitles
,