From 3f0852e35fbe3fbd2f635daadb02425608db5cf2 Mon Sep 17 00:00:00 2001 From: Roman Sebastian Karwacik Date: Sun, 12 Apr 2020 23:27:58 +0200 Subject: [PATCH 1/8] [zoomus] Add new extractor --- youtube_dlc/extractor/extractors.py | 1 + youtube_dlc/extractor/zoomus.py | 51 +++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 youtube_dlc/extractor/zoomus.py diff --git a/youtube_dlc/extractor/extractors.py b/youtube_dlc/extractor/extractors.py index 666134d86..34a8cecd5 100644 --- a/youtube_dlc/extractor/extractors.py +++ b/youtube_dlc/extractor/extractors.py @@ -1544,4 +1544,5 @@ ) from .zdf import ZDFIE, ZDFChannelIE from .zingmp3 import ZingMp3IE +from .zoomus import ZoomUSIE from .zype import ZypeIE diff --git a/youtube_dlc/extractor/zoomus.py b/youtube_dlc/extractor/zoomus.py new file mode 100644 index 000000000..150dbced7 --- /dev/null +++ b/youtube_dlc/extractor/zoomus.py @@ -0,0 +1,51 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + int_or_none, + parse_iso8601, + try_get, + url_or_none, +) + + +class ZoomUSIE(InfoExtractor): + IE_NAME = 'zoom.us' + _VALID_URL = r'https://zoom.us/recording/play/(?P.*)' + + _TESTS = [{ + 'url': 'https://zoom.us/recording/play/SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK', + 'info_dict': { + 'ext': 'mp4', + 'topic': "GAZ Transformational Tuesdays W/ Landon & Stapes", + 'recordFileName': "Shared screen with speaker view", + } + }] + + def _real_extract(self, url): + display_id = self._match_id(url) + webpage = self._download_webpage(url, display_id) + #cookie = self._get_cookies(url)['_zm_ssid'] + + video_url = self._search_regex(r"viewMp4Url: \'(.*)\'", webpage, 'video url') + topic = self._search_regex(r"topic: \"(.*)\",", webpage, 'video url') + viewResolvtionsWidth = self._search_regex(r"viewResolvtionsWidth: (.*),", webpage, 'res width') + viewResolvtionsHeight = self._search_regex(r"viewResolvtionsHeight: (.*),", webpage, 'res width') + + formats = [] + formats.append({ + 'url': video_url, + 'width': int_or_none(viewResolvtionsWidth), + 'height': int_or_none(viewResolvtionsHeight), + 'http_headers': {'Accept': 'video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5', + 'Referer': 'https://zoom.us/', + } + }) + self._sort_formats(formats) + + return { + 'id': display_id, + 'title': topic, + 'formats': formats + } \ No newline at end of file From ef6be42014694bf67afb38b19e951180a5d0e9fb Mon Sep 17 00:00:00 2001 From: Roman Sebastian Karwacik Date: Sun, 12 Apr 2020 23:40:00 +0200 Subject: [PATCH 2/8] [zoomus] Allow for more urls --- youtube_dlc/extractor/zoomus.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/youtube_dlc/extractor/zoomus.py b/youtube_dlc/extractor/zoomus.py index 150dbced7..cdcf026e8 100644 --- a/youtube_dlc/extractor/zoomus.py +++ b/youtube_dlc/extractor/zoomus.py @@ -12,7 +12,7 @@ class ZoomUSIE(InfoExtractor): IE_NAME = 'zoom.us' - _VALID_URL = r'https://zoom.us/recording/play/(?P.*)' + _VALID_URL = r'https://(.*).?zoom.us/rec(ording)?/play/(?P.*)' _TESTS = [{ 'url': 'https://zoom.us/recording/play/SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK', @@ -26,7 +26,6 @@ class ZoomUSIE(InfoExtractor): def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - #cookie = self._get_cookies(url)['_zm_ssid'] video_url = self._search_regex(r"viewMp4Url: \'(.*)\'", webpage, 'video url') topic = self._search_regex(r"topic: \"(.*)\",", webpage, 'video url') From 55cd2999edad0c9b148d5e9334a74be55bdb668c Mon Sep 17 00:00:00 2001 From: Roman Sebastian Karwacik Date: Mon, 13 Apr 2020 00:18:40 +0200 Subject: [PATCH 3/8] [zoomus] Cleanup --- youtube_dlc/extractor/zoomus.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/youtube_dlc/extractor/zoomus.py b/youtube_dlc/extractor/zoomus.py index cdcf026e8..a0e34801f 100644 --- a/youtube_dlc/extractor/zoomus.py +++ b/youtube_dlc/extractor/zoomus.py @@ -4,9 +4,6 @@ from .common import InfoExtractor from ..utils import ( int_or_none, - parse_iso8601, - try_get, - url_or_none, ) @@ -14,14 +11,15 @@ class ZoomUSIE(InfoExtractor): IE_NAME = 'zoom.us' _VALID_URL = r'https://(.*).?zoom.us/rec(ording)?/play/(?P.*)' - _TESTS = [{ + _TEST = { 'url': 'https://zoom.us/recording/play/SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK', 'info_dict': { - 'ext': 'mp4', - 'topic': "GAZ Transformational Tuesdays W/ Landon & Stapes", - 'recordFileName': "Shared screen with speaker view", + 'md5': '031a5b379f1547a8b29c5c4c837dccf2', + 'title': "GAZ Transformational Tuesdays W/ Landon & Stapes", + 'id': "SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK", + 'ext': "mp4", } - }] + } def _real_extract(self, url): display_id = self._match_id(url) @@ -37,9 +35,8 @@ def _real_extract(self, url): 'url': video_url, 'width': int_or_none(viewResolvtionsWidth), 'height': int_or_none(viewResolvtionsHeight), - 'http_headers': {'Accept': 'video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5', - 'Referer': 'https://zoom.us/', - } + 'http_headers': {'Accept': 'video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5', + 'Referer': 'https://zoom.us/'} }) self._sort_formats(formats) @@ -47,4 +44,4 @@ def _real_extract(self, url): 'id': display_id, 'title': topic, 'formats': formats - } \ No newline at end of file + } From abd273e17bb324296a81ea82be398e478ecdfa60 Mon Sep 17 00:00:00 2001 From: Roman Sebastian Karwacik Date: Mon, 13 Apr 2020 07:27:56 +0200 Subject: [PATCH 4/8] [zoomus] coding conventions --- youtube_dlc/extractor/zoomus.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/youtube_dlc/extractor/zoomus.py b/youtube_dlc/extractor/zoomus.py index a0e34801f..75a1b6375 100644 --- a/youtube_dlc/extractor/zoomus.py +++ b/youtube_dlc/extractor/zoomus.py @@ -4,12 +4,14 @@ from .common import InfoExtractor from ..utils import ( int_or_none, + url_or_none, + parse_filesize ) class ZoomUSIE(InfoExtractor): IE_NAME = 'zoom.us' - _VALID_URL = r'https://(.*).?zoom.us/rec(ording)?/play/(?P.*)' + _VALID_URL = r'https://(?:.*).?zoom.us/rec(?:ording)?/play/(?P[^?&=]{64})' _TEST = { 'url': 'https://zoom.us/recording/play/SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK', @@ -17,31 +19,33 @@ class ZoomUSIE(InfoExtractor): 'md5': '031a5b379f1547a8b29c5c4c837dccf2', 'title': "GAZ Transformational Tuesdays W/ Landon & Stapes", 'id': "SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK", - 'ext': "mp4", + 'ext': "mp4" } } def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - video_url = self._search_regex(r"viewMp4Url: \'(.*)\'", webpage, 'video url') - topic = self._search_regex(r"topic: \"(.*)\",", webpage, 'video url') - viewResolvtionsWidth = self._search_regex(r"viewResolvtionsWidth: (.*),", webpage, 'res width') - viewResolvtionsHeight = self._search_regex(r"viewResolvtionsHeight: (.*),", webpage, 'res width') + title = self._html_search_regex([r"topic: \"(.*)\",", r"(.*) - Zoom"], 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)) formats = [] formats.append({ - 'url': video_url, + 'url': url_or_none(video_url), 'width': int_or_none(viewResolvtionsWidth), 'height': int_or_none(viewResolvtionsHeight), 'http_headers': {'Accept': 'video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5', - 'Referer': 'https://zoom.us/'} + 'Referer': 'https://zoom.us/'}, + 'ext': "mp4", + 'filesize_approx': int_or_none(fileSize) }) self._sort_formats(formats) return { 'id': display_id, - 'title': topic, + 'title': title, 'formats': formats } From 81acad1279c59edf63ceb3348437521715276210 Mon Sep 17 00:00:00 2001 From: Roman Sebastian Karwacik Date: Mon, 20 Apr 2020 16:20:54 +0200 Subject: [PATCH 5/8] [zoomus] Added support for password protected videos --- youtube_dlc/extractor/zoomus.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/youtube_dlc/extractor/zoomus.py b/youtube_dlc/extractor/zoomus.py index 75a1b6375..eb8b0fd0c 100644 --- a/youtube_dlc/extractor/zoomus.py +++ b/youtube_dlc/extractor/zoomus.py @@ -3,9 +3,11 @@ from .common import InfoExtractor from ..utils import ( + ExtractorError, int_or_none, url_or_none, - parse_filesize + parse_filesize, + urlencode_postdata ) @@ -26,6 +28,12 @@ class ZoomUSIE(InfoExtractor): def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) + + password_protected = self._search_regex(r']+?id="(password_form)"', webpage, 'password field', fatal=False) + if password_protected is not None: + self._verify_video_password(url, display_id, webpage) + webpage = self._download_webpage(url, display_id) + video_url = self._search_regex(r"viewMp4Url: \'(.*)\'", webpage, 'video url') title = self._html_search_regex([r"topic: \"(.*)\",", r"(.*) - Zoom"], webpage, 'title') viewResolvtionsWidth = self._search_regex(r"viewResolvtionsWidth: (\d*)", webpage, 'res width', fatal=False) @@ -49,3 +57,24 @@ def _real_extract(self, url): 'title': title, 'formats': formats } + + 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']+?id="meetId" value="([^\"]+)"', webpage, 'meetId') + data = urlencode_postdata({ + 'id': meetId, + 'passwd': password, + 'action': "viewdetailedpage", + 'recaptcha': "" + }) + validation_url = url.split("zoom.us")[0]+"zoom.us/rec/validate_meet_passwd" + 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'])) From aa13f124a5afcca3af3086ab7bcdc74783a95127 Mon Sep 17 00:00:00 2001 From: Roman Sebastian Karwacik Date: Tue, 21 Apr 2020 09:48:35 +0200 Subject: [PATCH 6/8] [zoomus] Adjusted referer header, fixed formating for flake8 --- youtube_dlc/extractor/zoomus.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/youtube_dlc/extractor/zoomus.py b/youtube_dlc/extractor/zoomus.py index eb8b0fd0c..f61f35da8 100644 --- a/youtube_dlc/extractor/zoomus.py +++ b/youtube_dlc/extractor/zoomus.py @@ -40,13 +40,15 @@ def _real_extract(self, url): viewResolvtionsHeight = self._search_regex(r"viewResolvtionsHeight: (\d*)", webpage, 'res height', fatal=False) fileSize = parse_filesize(self._search_regex(r"fileSize: \'(.+)\'", webpage, 'fileSize', fatal=False)) + urlprefix = url.split("zoom.us")[0] + "zoom.us/" + formats = [] formats.append({ 'url': url_or_none(video_url), 'width': int_or_none(viewResolvtionsWidth), 'height': int_or_none(viewResolvtionsHeight), 'http_headers': {'Accept': 'video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5', - 'Referer': 'https://zoom.us/'}, + 'Referer': urlprefix}, 'ext': "mp4", 'filesize_approx': int_or_none(fileSize) }) @@ -69,7 +71,7 @@ def _verify_video_password(self, url, video_id, webpage): 'action': "viewdetailedpage", 'recaptcha': "" }) - validation_url = url.split("zoom.us")[0]+"zoom.us/rec/validate_meet_passwd" + validation_url = url.split("zoom.us")[0] + "zoom.us/rec/validate_meet_passwd" validation_response = self._download_json( validation_url, video_id, note='Validating Password...', From b11a88fc243a078c2addbcf0d1377bd65495bc05 Mon Sep 17 00:00:00 2001 From: Roman Sebastian Karwacik Date: Tue, 2 Jun 2020 13:07:10 +0200 Subject: [PATCH 7/8] [zoomus] Adjusted url regex, now allowing for arbitrary long ids, dont throw warning if password field not found --- youtube_dlc/extractor/zoomus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dlc/extractor/zoomus.py b/youtube_dlc/extractor/zoomus.py index f61f35da8..9aae30d37 100644 --- a/youtube_dlc/extractor/zoomus.py +++ b/youtube_dlc/extractor/zoomus.py @@ -13,7 +13,7 @@ class ZoomUSIE(InfoExtractor): IE_NAME = 'zoom.us' - _VALID_URL = r'https://(?:.*).?zoom.us/rec(?:ording)?/play/(?P[^?&=]{64})' + _VALID_URL = r'https://(?:.*).?zoom.us/rec(?:ording)?/play/(?P[A-Za-z0-9\-_]+)' _TEST = { 'url': 'https://zoom.us/recording/play/SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK', @@ -29,7 +29,7 @@ def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - password_protected = self._search_regex(r']+?id="(password_form)"', webpage, 'password field', fatal=False) + password_protected = self._search_regex(r']+?id="(password_form)"', webpage, 'password field', fatal=False, default=None) if password_protected is not None: self._verify_video_password(url, display_id, webpage) webpage = self._download_webpage(url, display_id) From 366a7a4753944802ed88638decd683f7472de53e Mon Sep 17 00:00:00 2001 From: insaneracist Date: Wed, 4 Nov 2020 12:13:51 -0800 Subject: [PATCH 8/8] [zoom] rename extractor from zoomus --- youtube_dlc/extractor/extractors.py | 2 +- youtube_dlc/extractor/{zoomus.py => zoom.py} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename youtube_dlc/extractor/{zoomus.py => zoom.py} (98%) diff --git a/youtube_dlc/extractor/extractors.py b/youtube_dlc/extractor/extractors.py index 34a8cecd5..24c107598 100644 --- a/youtube_dlc/extractor/extractors.py +++ b/youtube_dlc/extractor/extractors.py @@ -1544,5 +1544,5 @@ ) from .zdf import ZDFIE, ZDFChannelIE from .zingmp3 import ZingMp3IE -from .zoomus import ZoomUSIE +from .zoom import ZoomIE from .zype import ZypeIE diff --git a/youtube_dlc/extractor/zoomus.py b/youtube_dlc/extractor/zoom.py similarity index 98% rename from youtube_dlc/extractor/zoomus.py rename to youtube_dlc/extractor/zoom.py index 9aae30d37..003e1f901 100644 --- a/youtube_dlc/extractor/zoomus.py +++ b/youtube_dlc/extractor/zoom.py @@ -11,8 +11,8 @@ ) -class ZoomUSIE(InfoExtractor): - IE_NAME = 'zoom.us' +class ZoomIE(InfoExtractor): + IE_NAME = 'zoom' _VALID_URL = r'https://(?:.*).?zoom.us/rec(?:ording)?/play/(?P[A-Za-z0-9\-_]+)' _TEST = {