about summary refs log tree commit diff
path: root/youtube_dl/extractor/tdslifeway.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-04-15 04:28:54 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-04-15 04:28:54 +0800
commit56f1750049ee04d78d1349617124349bb1309cba (patch)
treeab7801c84060053af33f98d4b39cd509f68a1578 /youtube_dl/extractor/tdslifeway.py
parentf2159c9815fa056ca1d4ef4a6d1c31c4847b3d47 (diff)
downloadyoutube-dl-56f1750049ee04d78d1349617124349bb1309cba.tar.gz
youtube-dl-56f1750049ee04d78d1349617124349bb1309cba.tar.xz
youtube-dl-56f1750049ee04d78d1349617124349bb1309cba.zip
[tdslifeway] Use the new Brightcove API
Thanks for @remitamine's suggestion.
Diffstat (limited to 'youtube_dl/extractor/tdslifeway.py')
-rw-r--r--youtube_dl/extractor/tdslifeway.py41
1 files changed, 9 insertions, 32 deletions
diff --git a/youtube_dl/extractor/tdslifeway.py b/youtube_dl/extractor/tdslifeway.py
index 34c7a13fd..4d1f5c801 100644
--- a/youtube_dl/extractor/tdslifeway.py
+++ b/youtube_dl/extractor/tdslifeway.py
@@ -14,43 +14,20 @@ class TDSLifewayIE(InfoExtractor):
             'ext': 'mp4',
             'title': 'The Gospel by Numbers',
             'thumbnail': 're:^https?://.*\.jpg',
+            'upload_date': '20140410',
+            'description': 'Coming soon from T4G 2014!',
+            'uploader_id': '2034960640001',
+            'timestamp': 1397145591,
         },
         'params': {
             # m3u8 download
             'skip_download': True,
         },
+        'add_ie': ['BrightcoveNew'],
     }
 
-    def _real_extract(self, url):
-        video_id = self._match_id(url)
-
-        # XXX: A generic brightcove function?
-        json_data = self._download_json(
-            'http://api.brightcove.com/services/library', video_id,
-            query={
-                'command': 'find_video_by_id',
-                'video_id': video_id,
-                'video_fields': 'id,name,videoStillURL,HLSURL,FLVURL',
-                'media_delivery': 'http',
-                # token extracted from http://tds.lifeway.com/v1/trainingdeliverysystem/courses/player_test.js
-                'token': 'MrrNjVSP15NGY3R0gipp-lvclofucPXKD3skFouJMjZXM3KOS2ch0g..',
-            })
-
-        formats = []
+    BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/2034960640001/default_default/index.html?videoId=%s'
 
-        if 'HLSURL' in json_data:
-            formats.extend(self._extract_m3u8_formats(
-                json_data['HLSURL'], video_id, ext='mp4', m3u8_id='hls', fatal=False))
-        if 'FLVURL' in json_data:
-            formats.append({
-                'url': json_data['FLVURL'],
-            })
-
-        self._sort_formats(formats)
-
-        return {
-            'id': video_id,
-            'title': json_data['name'],
-            'thumbnail': json_data.get('videoStillURL'),
-            'formats': formats,
-        }
+    def _real_extract(self, url):
+        brightcove_id = self._match_id(url)
+        return self.url_result(self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew', brightcove_id)