1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-21 23:33:10 +00:00

[zoomus] coding conventions

This commit is contained in:
Roman Sebastian Karwacik 2020-04-13 07:27:56 +02:00 committed by insaneracist
parent 55cd2999ed
commit abd273e17b

View file

@ -4,12 +4,14 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
int_or_none, int_or_none,
url_or_none,
parse_filesize
) )
class ZoomUSIE(InfoExtractor): class ZoomUSIE(InfoExtractor):
IE_NAME = 'zoom.us' IE_NAME = 'zoom.us'
_VALID_URL = r'https://(.*).?zoom.us/rec(ording)?/play/(?P<id>.*)' _VALID_URL = r'https://(?:.*).?zoom.us/rec(?:ording)?/play/(?P<id>[^?&=]{64})'
_TEST = { _TEST = {
'url': 'https://zoom.us/recording/play/SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK', 'url': 'https://zoom.us/recording/play/SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK',
@ -17,31 +19,33 @@ class ZoomUSIE(InfoExtractor):
'md5': '031a5b379f1547a8b29c5c4c837dccf2', 'md5': '031a5b379f1547a8b29c5c4c837dccf2',
'title': "GAZ Transformational Tuesdays W/ Landon & Stapes", 'title': "GAZ Transformational Tuesdays W/ Landon & Stapes",
'id': "SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK", 'id': "SILVuCL4bFtRwWTtOCFQQxAsBQsJljFtm9e4Z_bvo-A8B-nzUSYZRNuPl3qW5IGK",
'ext': "mp4", 'ext': "mp4"
} }
} }
def _real_extract(self, url): def _real_extract(self, url):
display_id = self._match_id(url) display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, display_id)
video_url = self._search_regex(r"viewMp4Url: \'(.*)\'", webpage, 'video url') video_url = self._search_regex(r"viewMp4Url: \'(.*)\'", webpage, 'video url')
topic = self._search_regex(r"topic: \"(.*)\",", webpage, 'video url') title = self._html_search_regex([r"topic: \"(.*)\",", r"<title>(.*) - Zoom</title>"], webpage, 'title')
viewResolvtionsWidth = self._search_regex(r"viewResolvtionsWidth: (.*),", webpage, 'res width') viewResolvtionsWidth = self._search_regex(r"viewResolvtionsWidth: (\d*)", webpage, 'res width', fatal=False)
viewResolvtionsHeight = self._search_regex(r"viewResolvtionsHeight: (.*),", webpage, 'res width') 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 = []
formats.append({ formats.append({
'url': video_url, 'url': url_or_none(video_url),
'width': int_or_none(viewResolvtionsWidth), 'width': int_or_none(viewResolvtionsWidth),
'height': int_or_none(viewResolvtionsHeight), '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', '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) self._sort_formats(formats)
return { return {
'id': display_id, 'id': display_id,
'title': topic, 'title': title,
'formats': formats 'formats': formats
} }