1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-24 08:45:27 +00:00

[ted] Add width and height (Fixes #2716)

This commit is contained in:
Philipp Hagemeister 2014-04-07 13:07:07 +02:00
parent 09baa7da7e
commit 0ba77818f3

View file

@ -37,6 +37,7 @@ class TEDIE(SubtitlesInfoExtractor):
'consciousness, but that half the time our brains are ' 'consciousness, but that half the time our brains are '
'actively fooling us.'), 'actively fooling us.'),
'uploader': 'Dan Dennett', 'uploader': 'Dan Dennett',
'width': 854,
} }
}, { }, {
'url': 'http://www.ted.com/watch/ted-institute/ted-bcg/vishal-sikka-the-beauty-and-power-of-algorithms', '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 = { _NATIVE_FORMATS = {
'low': 1, 'low': {'preference': 1, 'width': 320, 'height': 180},
'medium': 2, 'medium': {'preference': 2, 'width': 512, 'height': 288},
'high': 3, 'high': {'preference': 3, 'width': 854, 'height': 480},
} }
def _extract_info(self, webpage): def _extract_info(self, webpage):
@ -98,12 +99,14 @@ class TEDIE(SubtitlesInfoExtractor):
talk_info = self._extract_info(webpage)['talks'][0] talk_info = self._extract_info(webpage)['talks'][0]
formats = [{ formats = [{
'ext': 'mp4',
'url': format_url, 'url': format_url,
'format_id': format_id, 'format_id': format_id,
'format': format_id, 'format': format_id,
'preference': self._FORMATS_PREFERENCE.get(format_id, -1),
} for (format_id, format_url) in talk_info['nativeDownloads'].items()] } 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) self._sort_formats(formats)
video_id = compat_str(talk_info['id']) video_id = compat_str(talk_info['id'])