2020-04-12 23:27:58 +02:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
2020-04-20 16:20:54 +02:00
|
|
|
ExtractorError,
|
2020-04-12 23:27:58 +02:00
|
|
|
int_or_none,
|
2020-04-13 07:27:56 +02:00
|
|
|
url_or_none,
|
2020-04-20 16:20:54 +02:00
|
|
|
parse_filesize,
|
|
|
|
urlencode_postdata
|
2020-04-12 23:27:58 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-11-04 21:13:51 +01:00
|
|
|
class ZoomIE(InfoExtractor):
|
|
|
|
IE_NAME = 'zoom'
|
2020-11-10 10:39:57 +01:00
|
|
|
_VALID_URL = r'https://(?:.*).?zoom.us/rec(?:ording)?/(play|share)/(?P<id>[A-Za-z0-9\-_.]+)'
|
2020-04-12 23:27:58 +02:00
|
|
|
|
2020-04-13 00:18:40 +02:00
|
|
|
_TEST = {
|
2020-04-12 23:27:58 +02:00
|
|
|
'url': 'https://zoom.us/recording/play/SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK',
|
|
|
|
'info_dict': {
|
2020-04-13 00:18:40 +02:00
|
|
|
'md5': '031a5b379f1547a8b29c5c4c837dccf2',
|
|
|
|
'title': "GAZ Transformational Tuesdays W/ Landon & Stapes",
|
|
|
|
'id': "SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK",
|
2020-04-13 07:27:56 +02:00
|
|
|
'ext': "mp4"
|
2020-04-12 23:27:58 +02:00
|
|
|
}
|
2020-04-13 00:18:40 +02:00
|
|
|
}
|
2020-04-12 23:27:58 +02:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
display_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, display_id)
|
2020-04-20 16:20:54 +02:00
|
|
|
|
2020-06-02 13:07:10 +02:00
|
|
|
password_protected = self._search_regex(r'<form[^>]+?id="(password_form)"', webpage, 'password field', fatal=False, default=None)
|
2020-04-20 16:20:54 +02:00
|
|
|
if password_protected is not None:
|
|
|
|
self._verify_video_password(url, display_id, webpage)
|
|
|
|
webpage = self._download_webpage(url, display_id)
|
|
|
|
|
2020-04-12 23:27:58 +02:00
|
|
|
video_url = self._search_regex(r"viewMp4Url: \'(.*)\'", webpage, 'video url')
|
2020-04-13 07:27:56 +02:00
|
|
|
title = self._html_search_regex([r"topic: \"(.*)\",", r"<title>(.*) - Zoom</title>"], webpage, 'title')
|
|
|
|
viewResolvtionsWidth = self._search_regex(r"viewResolvtionsWidth: (\d*)", webpage, 'res width', fatal=False)
|
|
|
|
viewResolvtionsHeight = self._search_regex(r"viewResolvtionsHeight: (\d*)", webpage, 'res height', fatal=False)
|
|
|
|
fileSize = parse_filesize(self._search_regex(r"fileSize: \'(.+)\'", webpage, 'fileSize', fatal=False))
|
2020-04-12 23:27:58 +02:00
|
|
|
|
2020-04-21 09:48:35 +02:00
|
|
|
urlprefix = url.split("zoom.us")[0] + "zoom.us/"
|
|
|
|
|
2020-04-12 23:27:58 +02:00
|
|
|
formats = []
|
|
|
|
formats.append({
|
2020-04-13 07:27:56 +02:00
|
|
|
'url': url_or_none(video_url),
|
2020-04-12 23:27:58 +02:00
|
|
|
'width': int_or_none(viewResolvtionsWidth),
|
|
|
|
'height': int_or_none(viewResolvtionsHeight),
|
2020-04-13 00:18:40 +02:00
|
|
|
'http_headers': {'Accept': 'video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5',
|
2020-04-21 09:48:35 +02:00
|
|
|
'Referer': urlprefix},
|
2020-04-13 07:27:56 +02:00
|
|
|
'ext': "mp4",
|
|
|
|
'filesize_approx': int_or_none(fileSize)
|
2020-04-12 23:27:58 +02:00
|
|
|
})
|
|
|
|
self._sort_formats(formats)
|
|
|
|
|
|
|
|
return {
|
|
|
|
'id': display_id,
|
2020-04-13 07:27:56 +02:00
|
|
|
'title': title,
|
2020-04-12 23:27:58 +02:00
|
|
|
'formats': formats
|
2020-04-13 00:18:40 +02:00
|
|
|
}
|
2020-04-20 16:20:54 +02:00
|
|
|
|
|
|
|
def _verify_video_password(self, url, video_id, webpage):
|
|
|
|
password = self._downloader.params.get('videopassword')
|
|
|
|
if password is None:
|
|
|
|
raise ExtractorError('This video is protected by a password, use the --video-password option', expected=True)
|
|
|
|
meetId = self._search_regex(r'<input[^>]+?id="meetId" value="([^\"]+)"', webpage, 'meetId')
|
|
|
|
data = urlencode_postdata({
|
|
|
|
'id': meetId,
|
|
|
|
'passwd': password,
|
|
|
|
'action': "viewdetailedpage",
|
|
|
|
'recaptcha': ""
|
|
|
|
})
|
2020-04-21 09:48:35 +02:00
|
|
|
validation_url = url.split("zoom.us")[0] + "zoom.us/rec/validate_meet_passwd"
|
2020-04-20 16:20:54 +02:00
|
|
|
validation_response = self._download_json(
|
|
|
|
validation_url, video_id,
|
|
|
|
note='Validating Password...',
|
|
|
|
errnote='Wrong password?',
|
|
|
|
data=data)
|
|
|
|
|
|
|
|
if validation_response['errorCode'] != 0:
|
|
|
|
raise ExtractorError('Login failed, %s said: %r' % (self.IE_NAME, validation_response['errorMessage']))
|