[youtube] Handle cases where format comes without a preference (Fixes #4648)
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 5 Jan 2015 21:42:17 +0000 (22:42 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 5 Jan 2015 21:42:17 +0000 (22:42 +0100)
youtube_dl/extractor/youtube.py

index d1bbf0b01ae7ccb7c67bb468a904b9659e6fd14b..4aa8615b44929d4d195acaed7e18948495235848 100644 (file)
@@ -1046,7 +1046,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
                     for f in formats:
                         if f['format_id'] in dash_keys:
                             f['format_id'] = 'nondash-%s' % f['format_id']
-                            f['preference'] -= 10000
+                            f['preference'] = f.get('preference', 0) - 10000
                     formats.extend(dash_formats)
 
         self._sort_formats(formats)