[ted] Prepare #980 merge
authorPhilipp Hagemeister <phihag@phihag.de>
Fri, 4 Oct 2013 08:32:34 +0000 (10:32 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Fri, 4 Oct 2013 08:32:34 +0000 (10:32 +0200)
youtube_dl/extractor/ted.py

index 4c11f7a03c37136c0c80677e55b66598c647edeb..dfa1176a3e4e4eef333dcb829773c189bf9916ba 100644 (file)
@@ -77,12 +77,20 @@ class TEDIE(InfoExtractor):
         
         thumbnail = self._search_regex(r'</span>[\s.]*</div>[\s.]*<img src="(.*?)"',
                                        webpage, 'thumbnail')
+        formats = [{
+            'ext': 'mp4',
+            'url': stream['file'],
+            'format': stream['id']
+            } for stream in info['htmlStreams']]
         info = {
-                'id': info['id'],
-                'url': info['htmlStreams'][-1]['file'],
-                'ext': 'mp4',
-                'title': title,
-                'thumbnail': thumbnail,
-                'description': desc,
-                }
+            'id': info['id'],
+            'title': title,
+            'thumbnail': thumbnail,
+            'description': desc,
+            'formats': formats,
+        }
+
+        # TODO: Remove when #980 has been merged
+        info.update(info['formats'][-1])
+
         return info