aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-04-14 15:23:12 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-04-14 15:23:12 +0200
commit2d4c98dbd17676978114b70d59ea15628f886c24 (patch)
tree9b562ad61c9601104d59bb19ba626cb856eed99e
parentfd50bf623c3b3696ade7b8e1e5f4e0c283eabaaf (diff)
[ted] Use the rtmp links if there http downloads are not available.
-rw-r--r--youtube_dl/extractor/ted.py35
1 files changed, 30 insertions, 5 deletions
diff --git a/youtube_dl/extractor/ted.py b/youtube_dl/extractor/ted.py
index be7a0f866..df569a876 100644
--- a/youtube_dl/extractor/ted.py
+++ b/youtube_dl/extractor/ted.py
@@ -49,6 +49,19 @@ class TEDIE(SubtitlesInfoExtractor):
'thumbnail': 're:^https?://.+\.jpg',
'description': 'Adaptive, intelligent, and consistent, algorithms are emerging as the ultimate app for everything from matching consumers to products to assessing medical diagnoses. Vishal Sikka shares his appreciation for the algorithm, charting both its inherent beauty and its growing power.',
}
+ }, {
+ 'url': 'http://www.ted.com/talks/gabby_giffords_and_mark_kelly_be_passionate_be_courageous_be_your_best',
+ 'info_dict': {
+ 'id': '1972',
+ 'ext': 'flv',
+ 'title': 'Be passionate. Be courageous. Be your best.',
+ 'uploader': 'Gabby Giffords and Mark Kelly',
+ 'description': 'md5:d89e1d8ebafdac8e55df4c219ecdbfe9',
+ },
+ 'params': {
+ # rtmp download
+ 'skip_download': True,
+ },
}]
_NATIVE_FORMATS = {
@@ -102,11 +115,23 @@ class TEDIE(SubtitlesInfoExtractor):
'url': format_url,
'format_id': format_id,
'format': format_id,
- } 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)
+ } for (format_id, format_url) in talk_info['nativeDownloads'].items() if format_url is not None]
+ if formats:
+ for f in formats:
+ finfo = self._NATIVE_FORMATS.get(f['format_id'])
+ if finfo:
+ f.update(finfo)
+ else:
+ # Use rtmp downloads
+ formats = [{
+ 'format_id': f['name'],
+ 'url': talk_info['streamer'],
+ 'play_path': f['file'],
+ 'ext': 'flv',
+ 'width': f['width'],
+ 'height': f['height'],
+ 'tbr': f['bitrate'],
+ } for f in talk_info['resources']['rtmp']]
self._sort_formats(formats)
video_id = compat_str(talk_info['id'])