Przeglądaj źródła

[brightcove] Set the filesize of the formats and use _sort_formats

Jaime Marquínez Ferrándiz 11 lat temu
rodzic
commit
35eacd0dae
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      youtube_dl/extractor/brightcove.py

+ 3 - 1
youtube_dl/extractor/brightcove.py

@@ -235,7 +235,6 @@ class BrightcoveIE(InfoExtractor):
 
 
         renditions = video_info.get('renditions')
         renditions = video_info.get('renditions')
         if renditions:
         if renditions:
-            renditions = sorted(renditions, key=lambda r: r['size'])
             formats = []
             formats = []
             for rend in renditions:
             for rend in renditions:
                 url = rend['defaultURL']
                 url = rend['defaultURL']
@@ -246,12 +245,15 @@ class BrightcoveIE(InfoExtractor):
                     ext = 'flv'
                     ext = 'flv'
                 else:
                 else:
                     ext = determine_ext(url)
                     ext = determine_ext(url)
+                size = rend.get('size')
                 formats.append({
                 formats.append({
                     'url': url,
                     'url': url,
                     'ext': ext,
                     'ext': ext,
                     'height': rend.get('frameHeight'),
                     'height': rend.get('frameHeight'),
                     'width': rend.get('frameWidth'),
                     'width': rend.get('frameWidth'),
+                    'filesize': size if size != 0 else None,
                 })
                 })
+            self._sort_formats(formats)
             info['formats'] = formats
             info['formats'] = formats
         elif video_info.get('FLVFullLengthURL') is not None:
         elif video_info.get('FLVFullLengthURL') is not None:
             info.update({
             info.update({