Merge remote-tracking branch 'epitron/metadata-pp'
[youtube-dl] / youtube_dl / extractor / spiegel.py
index 6dc2eda6d9740ed4464d30018bb8d23395034eae..051a34d5b8b048db9112ac2df5f3f04115447a87 100644 (file)
@@ -1,8 +1,6 @@
 import re
-import xml.etree.ElementTree
 
 from .common import InfoExtractor
-from ..utils import determine_ext
 
 
 class SpiegelIE(InfoExtractor):
@@ -34,12 +32,10 @@ class SpiegelIE(InfoExtractor):
             r'<div class="module-title">(.*?)</div>', webpage, u'title')
 
         xml_url = u'http://video2.spiegel.de/flash/' + video_id + u'.xml'
-        xml_code = self._download_webpage(
+        idoc = self._download_xml(
             xml_url, video_id,
             note=u'Downloading XML', errnote=u'Failed to download XML')
 
-        idoc = xml.etree.ElementTree.fromstring(xml_code)
-
         formats = [
             {
                 'format_id': n.tag.rpartition('type')[2],
@@ -55,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,