[zoom] Add support for screen cast (#2699)

Authored by: Mipsters
This commit is contained in:
Tom 2022-02-12 16:22:51 +02:00 committed by GitHub
parent 7bc33ad0e9
commit a3eb987e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
int_or_none, int_or_none,
str_or_none,
js_to_json, js_to_json,
parse_filesize, parse_filesize,
urlencode_postdata, urlencode_postdata,
@ -23,7 +24,8 @@ class ZoomIE(InfoExtractor):
'id': 'dUk_CNBETmZ5VA2BwEl-jjakPpJ3M1pcfVYAPRsoIbEByGsLjUZtaa4yCATQuOL3der8BlTwxQePl_j0.EImBkXzTIaPvdZO5', 'id': 'dUk_CNBETmZ5VA2BwEl-jjakPpJ3M1pcfVYAPRsoIbEByGsLjUZtaa4yCATQuOL3der8BlTwxQePl_j0.EImBkXzTIaPvdZO5',
'ext': 'mp4', 'ext': 'mp4',
'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',
} }
def _real_extract(self, url): def _real_extract(self, url):
@ -56,22 +58,46 @@ def _real_extract(self, url):
webpage, 'data'), play_id, js_to_json) webpage, 'data'), play_id, js_to_json)
subtitles = {} subtitles = {}
for _type in ('transcript', 'cc'): for _type in ('transcript', 'cc', 'chapter'):
if data.get('%sUrl' % _type): if data.get('%sUrl' % _type):
subtitles[_type] = [{ subtitles[_type] = [{
'url': urljoin(base_url, data['%sUrl' % _type]), 'url': urljoin(base_url, data['%sUrl' % _type]),
'ext': 'vtt', 'ext': 'vtt',
}] }]
formats = []
if data.get('viewMp4Url'):
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')),
'ext': 'mp4',
'filesize_approx': parse_filesize(data.get('fileSize')),
'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')),
'ext': 'mp4',
'preference': -1
})
self._sort_formats(formats)
return { return {
'id': play_id, 'id': play_id,
'title': data['topic'], 'title': data.get('topic'),
'url': data['viewMp4Url'],
'subtitles': subtitles, 'subtitles': subtitles,
'width': int_or_none(data.get('viewResolvtionsWidth')), 'formats': formats,
'height': int_or_none(data.get('viewResolvtionsHeight')),
'http_headers': { 'http_headers': {
'Referer': base_url, 'Referer': base_url,
}, },
'filesize_approx': parse_filesize(data.get('fileSize')),
} }