Skip to content

Commit

Permalink
[extractor/zoom] Fix extractor (yt-dlp#6741)
Browse files Browse the repository at this point in the history
Authored by: shreyasminocha
Closes yt-dlp#6677
  • Loading branch information
shreyasminocha authored Apr 11, 2023
1 parent faa0332 commit 79c77e8
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions yt_dlp/extractor/zoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
str_or_none,
js_to_json,
parse_filesize,
traverse_obj,
urlencode_postdata,
urljoin,
)
Expand Down Expand Up @@ -53,6 +54,9 @@ def _real_extract(self, url):
r'(?s)window\.__data__\s*=\s*({.+?});',
webpage, 'data'), play_id, js_to_json)

data = self._download_json(
f'{base_url}nws/recording/1.0/play/info/{data["fileId"]}', play_id)['result']

subtitles = {}
for _type in ('transcript', 'cc', 'chapter'):
if data.get('%sUrl' % _type):
Expand All @@ -67,28 +71,28 @@ def _real_extract(self, url):
formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
'width': int_or_none(data.get('viewResolvtionsWidth')),
'height': int_or_none(data.get('viewResolvtionsHeight')),
'format_id': str_or_none(data.get('recordingId')),
'width': int_or_none(traverse_obj(data, ('viewResolvtions', 0))),
'height': int_or_none(traverse_obj(data, ('viewResolvtions', 1))),
'format_id': str_or_none(traverse_obj(data, ('recording', 'id'))),
'ext': 'mp4',
'filesize_approx': parse_filesize(data.get('fileSize')),
'filesize_approx': parse_filesize(str_or_none(traverse_obj(data, ('recording', 'fileSizeInMB')))),
'preference': 0
})

if data.get('shareMp4Url'):
formats.append({
'format_note': 'Screen share stream',
'url': str_or_none(data.get('shareMp4Url')),
'width': int_or_none(data.get('shareResolvtionsWidth')),
'height': int_or_none(data.get('shareResolvtionsHeight')),
'format_id': str_or_none(data.get('shareVideoId')),
'width': int_or_none(traverse_obj(data, ('shareResolvtions', 0))),
'height': int_or_none(traverse_obj(data, ('shareResolvtions', 1))),
'format_id': str_or_none(traverse_obj(data, ('shareVideo', 'id'))),
'ext': 'mp4',
'preference': -1
})

return {
'id': play_id,
'title': data.get('topic'),
'title': str_or_none(traverse_obj(data, ('meet', 'topic'))),
'subtitles': subtitles,
'formats': formats,
'http_headers': {
Expand Down

0 comments on commit 79c77e8

Please sign in to comment.