mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-26 05:05:54 +01:00
[extractor/zoom] Fix share URL extraction (#6789)
Authored by: bashonly
This commit is contained in:
parent
56793f74c3
commit
90c1f51206
@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
class ZoomIE(InfoExtractor):
|
class ZoomIE(InfoExtractor):
|
||||||
IE_NAME = 'zoom'
|
IE_NAME = 'zoom'
|
||||||
_VALID_URL = r'(?P<base_url>https?://(?:[^.]+\.)?zoom.us/)rec(?:ording)?/(?:play|share)/(?P<id>[A-Za-z0-9_.-]+)'
|
_VALID_URL = r'(?P<base_url>https?://(?:[^.]+\.)?zoom.us/)rec(?:ording)?/(?P<type>play|share)/(?P<id>[A-Za-z0-9_.-]+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'https://economist.zoom.us/rec/play/dUk_CNBETmZ5VA2BwEl-jjakPpJ3M1pcfVYAPRsoIbEByGsLjUZtaa4yCATQuOL3der8BlTwxQePl_j0.EImBkXzTIaPvdZO5',
|
'url': 'https://economist.zoom.us/rec/play/dUk_CNBETmZ5VA2BwEl-jjakPpJ3M1pcfVYAPRsoIbEByGsLjUZtaa4yCATQuOL3der8BlTwxQePl_j0.EImBkXzTIaPvdZO5',
|
||||||
'md5': 'ab445e8c911fddc4f9adc842c2c5d434',
|
'md5': 'ab445e8c911fddc4f9adc842c2c5d434',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -23,17 +23,37 @@ class ZoomIE(InfoExtractor):
|
|||||||
'title': 'China\'s "two sessions" and the new five-year plan',
|
'title': 'China\'s "two sessions" and the new five-year plan',
|
||||||
},
|
},
|
||||||
'skip': 'Recording requires email authentication to access',
|
'skip': 'Recording requires email authentication to access',
|
||||||
}
|
}, {
|
||||||
|
# play URL
|
||||||
|
'url': 'https://ffgolf.zoom.us/rec/play/qhEhXbrxq1Zoucx8CMtHzq1Z_2YZRPVCqWK_K-2FkEGRsSLDeOX8Tu4P6jtjZcRry8QhIbvKZdtr4UNo.QcPn2debFskI9whJ',
|
||||||
|
'md5': '2c4b1c4e5213ebf9db293e88d9385bee',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'qhEhXbrxq1Zoucx8CMtHzq1Z_2YZRPVCqWK_K-2FkEGRsSLDeOX8Tu4P6jtjZcRry8QhIbvKZdtr4UNo.QcPn2debFskI9whJ',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Prépa AF2023 - Séance 5 du 11 avril - R20/VM/GO',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
# share URL
|
||||||
|
'url': 'https://us02web.zoom.us/rec/share/hkUk5Zxcga0nkyNGhVCRfzkA2gX_mzgS3LpTxEEWJz9Y_QpIQ4mZFOUx7KZRZDQA.9LGQBdqmDAYgiZ_8',
|
||||||
|
'md5': '90fdc7cfcaee5d52d1c817fc03c43c9b',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'hkUk5Zxcga0nkyNGhVCRfzkA2gX_mzgS3LpTxEEWJz9Y_QpIQ4mZFOUx7KZRZDQA.9LGQBdqmDAYgiZ_8',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Timea Andrea Lelik\'s Personal Meeting Room',
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _get_page_data(self, webpage, video_id):
|
||||||
base_url, play_id = self._match_valid_url(url).groups()
|
return self._search_json(
|
||||||
webpage = self._download_webpage(url, play_id)
|
r'window\.__data__\s*=', webpage, 'data', video_id, transform_source=js_to_json)
|
||||||
|
|
||||||
|
def _get_real_webpage(self, url, base_url, video_id, url_type):
|
||||||
|
webpage = self._download_webpage(url, video_id, note=f'Downloading {url_type} webpage')
|
||||||
try:
|
try:
|
||||||
form = self._form_hidden_inputs('password_form', webpage)
|
form = self._form_hidden_inputs('password_form', webpage)
|
||||||
except ExtractorError:
|
except ExtractorError:
|
||||||
form = None
|
return webpage
|
||||||
if form:
|
|
||||||
password = self.get_param('videopassword')
|
password = self.get_param('videopassword')
|
||||||
if not password:
|
if not password:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
@ -41,21 +61,35 @@ def _real_extract(self, url):
|
|||||||
is_meeting = form.get('useWhichPasswd') == 'meeting'
|
is_meeting = form.get('useWhichPasswd') == 'meeting'
|
||||||
validation = self._download_json(
|
validation = self._download_json(
|
||||||
base_url + 'rec/validate%s_passwd' % ('_meet' if is_meeting else ''),
|
base_url + 'rec/validate%s_passwd' % ('_meet' if is_meeting else ''),
|
||||||
play_id, 'Validating passcode', 'Wrong passcode', data=urlencode_postdata({
|
video_id, 'Validating passcode', 'Wrong passcode', data=urlencode_postdata({
|
||||||
'id': form[('meet' if is_meeting else 'file') + 'Id'],
|
'id': form[('meet' if is_meeting else 'file') + 'Id'],
|
||||||
'passwd': password,
|
'passwd': password,
|
||||||
'action': form.get('action'),
|
'action': form.get('action'),
|
||||||
}))
|
}))
|
||||||
if not validation.get('status'):
|
if not validation.get('status'):
|
||||||
raise ExtractorError(validation['errorMessage'], expected=True)
|
raise ExtractorError(validation['errorMessage'], expected=True)
|
||||||
webpage = self._download_webpage(url, play_id)
|
return self._download_webpage(url, video_id, note=f'Re-downloading {url_type} webpage')
|
||||||
|
|
||||||
data = self._parse_json(self._search_regex(
|
def _real_extract(self, url):
|
||||||
r'(?s)window\.__data__\s*=\s*({.+?});',
|
base_url, url_type, video_id = self._match_valid_url(url).group('base_url', 'type', 'id')
|
||||||
webpage, 'data'), play_id, js_to_json)
|
|
||||||
|
if url_type == 'share':
|
||||||
|
webpage = self._get_real_webpage(url, base_url, video_id, 'share')
|
||||||
|
meeting_id = self._get_page_data(webpage, video_id)['meetingId']
|
||||||
|
redirect_path = self._download_json(
|
||||||
|
f'{base_url}nws/recording/1.0/play/share-info/{meeting_id}',
|
||||||
|
video_id, note='Downloading share info JSON')['result']['redirectUrl']
|
||||||
|
url = urljoin(base_url, redirect_path)
|
||||||
|
|
||||||
|
webpage = self._get_real_webpage(url, base_url, video_id, 'play')
|
||||||
|
file_id = self._get_page_data(webpage, video_id)['fileId']
|
||||||
|
if not file_id:
|
||||||
|
# When things go wrong, file_id can be empty string
|
||||||
|
raise ExtractorError('Unable to extract file ID')
|
||||||
|
|
||||||
data = self._download_json(
|
data = self._download_json(
|
||||||
f'{base_url}nws/recording/1.0/play/info/{data["fileId"]}', play_id)['result']
|
f'{base_url}nws/recording/1.0/play/info/{file_id}', video_id,
|
||||||
|
note='Downloading play info JSON')['result']
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
for _type in ('transcript', 'cc', 'chapter'):
|
for _type in ('transcript', 'cc', 'chapter'):
|
||||||
@ -91,7 +125,7 @@ def _real_extract(self, url):
|
|||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': play_id,
|
'id': video_id,
|
||||||
'title': str_or_none(traverse_obj(data, ('meet', 'topic'))),
|
'title': str_or_none(traverse_obj(data, ('meet', 'topic'))),
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
Loading…
Reference in New Issue
Block a user