[vbox7] Add support of multiple formats

This commit is contained in:
lsimeonov2 2018-12-30 13:44:11 -05:00
parent 140a13f5de
commit 6963bde436
1 changed files with 19 additions and 1 deletions

View File

@ -93,10 +93,28 @@ class Vbox7IE(InfoExtractor):
webpage.replace('"/*@context"', '"@context"'), video_id,
fatal=False)
formats = []
if 'videoIsHD' in video:
resolution = 720
else:
resolution = 480
for resolution in video.get('resolutions', [resolution]):
if 0 == resolution:
continue
format_url = video_url.replace('.mpd', '_' + str(resolution) + '.mp4')
formats.append({
'url': format_url,
'format_id': '%s' % str(resolution),
'height': int(resolution),
'ext': 'mp4'
})
self._sort_formats(formats, field_preference=('height'))
info.update({
'id': video_id,
'title': title,
'url': video_url,
'formats': formats,
'uploader': uploader,
'thumbnail': self._proto_relative_url(
info.get('thumbnail') or self._og_search_thumbnail(webpage),