mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-05 04:27:05 +01:00
[spiegel] Use centralized sorting
This commit is contained in:
parent
719d3927d7
commit
e6812ac99d
@ -438,6 +438,11 @@ def _media_rating_search(self, html):
|
|||||||
|
|
||||||
def _sort_formats(self, formats):
|
def _sort_formats(self, formats):
|
||||||
def _formats_key(f):
|
def _formats_key(f):
|
||||||
|
# TODO remove the following workaround
|
||||||
|
from ..utils import determine_ext
|
||||||
|
if not f.get('ext') and 'url' in f:
|
||||||
|
f['ext'] = determine_ext(f['url'])
|
||||||
|
|
||||||
preference = f.get('preference')
|
preference = f.get('preference')
|
||||||
if preference is None:
|
if preference is None:
|
||||||
preference = 0 if f.get('url', '').startswith('http') else -0.1
|
preference = 0 if f.get('url', '').startswith('http') else -0.1
|
||||||
|
@ -51,9 +51,10 @@ def _real_extract(self, url):
|
|||||||
# Blacklist type 6, it's extremely LQ and not available on the same server
|
# Blacklist type 6, it's extremely LQ and not available on the same server
|
||||||
if n.tag.startswith('type') and n.tag != 'type6'
|
if n.tag.startswith('type') and n.tag != 'type6'
|
||||||
]
|
]
|
||||||
formats.sort(key=lambda f: f['vbr'])
|
|
||||||
duration = float(idoc[0].findall('./duration')[0].text)
|
duration = float(idoc[0].findall('./duration')[0].text)
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
|
Loading…
Reference in New Issue
Block a user