summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-04-07 13:07:07 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-04-07 13:11:30 +0200
commit0ba77818f39acbf59402d383e8082bb34e0dec5a (patch)
tree339437a1045f47763c8b38189188641b249eb9b3
parent09baa7da7eed5ea4150c6c5d07325901da3aef62 (diff)
downloadyoutube-dl-0ba77818f39acbf59402d383e8082bb34e0dec5a.tar.gz
youtube-dl-0ba77818f39acbf59402d383e8082bb34e0dec5a.tar.xz
youtube-dl-0ba77818f39acbf59402d383e8082bb34e0dec5a.zip
[ted] Add width and height (Fixes #2716)
-rw-r--r--youtube_dl/extractor/ted.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/youtube_dl/extractor/ted.py b/youtube_dl/extractor/ted.py
index a8d8e8b29..be7a0f866 100644
--- a/youtube_dl/extractor/ted.py
+++ b/youtube_dl/extractor/ted.py
@@ -37,6 +37,7 @@ class TEDIE(SubtitlesInfoExtractor):
                 'consciousness, but that half the time our brains are '
                 'actively fooling us.'),
             'uploader': 'Dan Dennett',
+            'width': 854,
         }
     }, {
         'url': 'http://www.ted.com/watch/ted-institute/ted-bcg/vishal-sikka-the-beauty-and-power-of-algorithms',
@@ -50,10 +51,10 @@ class TEDIE(SubtitlesInfoExtractor):
         }
     }]
 
-    _FORMATS_PREFERENCE = {
-        'low': 1,
-        'medium': 2,
-        'high': 3,
+    _NATIVE_FORMATS = {
+        'low': {'preference': 1, 'width': 320, 'height': 180},
+        'medium': {'preference': 2, 'width': 512, 'height': 288},
+        'high': {'preference': 3, 'width': 854, 'height': 480},
     }
 
     def _extract_info(self, webpage):
@@ -98,12 +99,14 @@ class TEDIE(SubtitlesInfoExtractor):
         talk_info = self._extract_info(webpage)['talks'][0]
 
         formats = [{
-            'ext': 'mp4',
             'url': format_url,
             'format_id': format_id,
             'format': format_id,
-            'preference': self._FORMATS_PREFERENCE.get(format_id, -1),
         } for (format_id, format_url) in talk_info['nativeDownloads'].items()]
+        for f in formats:
+            finfo = self._NATIVE_FORMATS.get(f['format_id'])
+            if finfo:
+                f.update(finfo)
         self._sort_formats(formats)
 
         video_id = compat_str(talk_info['id'])