mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-23 16:26:40 +00:00
[internetvideoarchive] Use centralized format sorting
This commit is contained in:
parent
4bc60dafeb
commit
12c978739a
1 changed files with 8 additions and 5 deletions
|
@ -5,7 +5,6 @@ from ..utils import (
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
xpath_with_ns,
|
xpath_with_ns,
|
||||||
determine_ext,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,13 +62,17 @@ class InternetVideoArchiveIE(InfoExtractor):
|
||||||
for content in item.findall(_bp('media:group/media:content')):
|
for content in item.findall(_bp('media:group/media:content')):
|
||||||
attr = content.attrib
|
attr = content.attrib
|
||||||
f_url = attr['url']
|
f_url = attr['url']
|
||||||
|
width = int(attr['width'])
|
||||||
|
bitrate = int(attr['bitrate'])
|
||||||
|
format_id = '%d-%dk' % (width, bitrate)
|
||||||
formats.append({
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
'url': f_url,
|
'url': f_url,
|
||||||
'ext': determine_ext(f_url),
|
'width': width,
|
||||||
'width': int(attr['width']),
|
'tbr': bitrate,
|
||||||
'bitrate': int(attr['bitrate']),
|
|
||||||
})
|
})
|
||||||
formats = sorted(formats, key=lambda f: f['bitrate'])
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
Loading…
Reference in a new issue