From e6812ac99dfc9117f3dd78425bf4bbe01601ecfd Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Tue, 24 Dec 2013 12:40:23 +0100 Subject: [PATCH] [spiegel] Use centralized sorting --- youtube_dl/extractor/common.py | 5 +++++ youtube_dl/extractor/spiegel.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 280693d1d..0a90382de 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -438,6 +438,11 @@ class InfoExtractor(object): def _sort_formats(self, formats): 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') if preference is None: preference = 0 if f.get('url', '').startswith('http') else -0.1 diff --git a/youtube_dl/extractor/spiegel.py b/youtube_dl/extractor/spiegel.py index 695520524..051a34d5b 100644 --- a/youtube_dl/extractor/spiegel.py +++ b/youtube_dl/extractor/spiegel.py @@ -51,9 +51,10 @@ class SpiegelIE(InfoExtractor): # Blacklist type 6, it's extremely LQ and not available on the same server if n.tag.startswith('type') and n.tag != 'type6' ] - formats.sort(key=lambda f: f['vbr']) duration = float(idoc[0].findall('./duration')[0].text) + self._sort_formats(formats) + info = { 'id': video_id, 'title': video_title,