1 from .common
import InfoExtractor
2 from ..compat
import compat_str
11 class VzaarIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:(?:www|view)\.)?vzaar\.com/(?:videos/)?(?P<id>\d+)'
13 _EMBED_REGEX
= [r
'<iframe[^>]+src=["\'](?P
<url
>(?
:https?
:)?
//(?
:view\
.vzaar\
.com
)/[0-9]+)']
16 'url
': 'https
://vzaar
.com
/videos
/1152805',
17 'md5
': 'bde5ddfeb104a6c56a93a06b04901dbf
',
21 'title
': 'sample
video (public
)',
24 'url
': 'https
://view
.vzaar
.com
/27272/player
',
25 'md5
': '3b50012ac9bbce7f445550d54e0508f2
',
33 'url
': 'https
://view
.vzaar
.com
/11379930/player
',
41 'skip_download
': True,
44 # with null videoTitle
45 'url
': 'https
://view
.vzaar
.com
/20313539/download
',
46 'only_matching
': True,
49 def _real_extract(self, url):
50 video_id = self._match_id(url)
51 video_data = self._download_json(
52 'http
://view
.vzaar
.com
/v2
/%s/video
' % video_id, video_id)
54 title = video_data.get('videoTitle
') or video_id
58 source_url = url_or_none(video_data.get('sourceUrl
'))
65 if 'audio
' in source_url:
72 'width
': int_or_none(video_data.get('width
')),
73 'height
': int_or_none(video_data.get('height
')),
75 'fps
': float_or_none(video_data.get('fps
')),
79 video_guid = video_data.get('guid
')
80 usp = video_data.get('usp
')
81 if video_data.get('uspEnabled
') and isinstance(video_guid, compat_str) and isinstance(usp, dict):
82 hls_aes = video_data.get('hlsAes
')
83 qs = '&'.join('%s=%s' % (k, v) for k, v in usp.items())
84 url_templ = 'http
://%%s.vzaar
.com
/v5
/usp
%s/%s/%s.ism
%%s?
' % ('aes
' if hls_aes else '', video_guid, video_id)
85 m3u8_formats = self._extract_m3u8_formats(
86 url_templ % ('fable
', '/.m3u8
') + qs, video_id, 'mp4
', 'm3u8_native
',
87 m3u8_id='hls
', fatal=False)
89 for f in m3u8_formats:
90 f['hls_aes
'] = {'uri': url_templ % ('goose', '') + qs}
91 formats.extend(m3u8_formats)
96 'thumbnail
': self._proto_relative_url(video_data.get('poster
')),
97 'duration
': float_or_none(video_data.get('videoDuration
')),
98 'timestamp
': unified_timestamp(video_data.get('ts
')),