mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[ivi] Use centralized format sorting
This commit is contained in:
parent
bfe9de8510
commit
bf5b0a1bfb
1 changed files with 9 additions and 7 deletions
|
@ -84,14 +84,16 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
result = video_json[u'result']
|
result = video_json[u'result']
|
||||||
|
|
||||||
formats = [{'url': x[u'url'],
|
formats = [{
|
||||||
'format_id': x[u'content_format']
|
'url': x[u'url'],
|
||||||
} for x in result[u'files'] if x[u'content_format'] in self._known_formats]
|
'format_id': x[u'content_format'],
|
||||||
formats.sort(key=lambda fmt: self._known_formats.index(fmt['format_id']))
|
'preference': self._known_formats.index(x[u'content_format']),
|
||||||
|
} for x in result[u'files'] if x[u'content_format'] in self._known_formats]
|
||||||
|
|
||||||
if len(formats) == 0:
|
self._sort_formats(formats)
|
||||||
self._downloader.report_warning(u'No media links available for %s' % video_id)
|
|
||||||
return
|
if not formats:
|
||||||
|
raise ExtractorError(u'No media links available for %s' % video_id)
|
||||||
|
|
||||||
duration = result[u'duration']
|
duration = result[u'duration']
|
||||||
compilation = result[u'compilation']
|
compilation = result[u'compilation']
|
||||||
|
|
Loading…
Reference in a new issue