]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[discovery] extract subtitle
authorremitamine <remitamine@gmail.com>
Sat, 30 Apr 2016 19:49:09 +0000 (20:49 +0100)
committerremitamine <remitamine@gmail.com>
Sat, 30 Apr 2016 19:51:32 +0000 (20:51 +0100)
youtube_dl/extractor/discovery.py

index 6d1f8e67021c490285c5d2f2b34bd93a50d31b25..87fb29b022d5c1e5d1cb0f7c334c348606187185 100644 (file)
@@ -114,6 +114,16 @@ class DiscoveryIE(InfoExtractor):
                                 'tbr': q,
                             })
             self._sort_formats(formats)
+
+            subtitles = []
+            caption_url = video_info.get('captionsUrl')
+            if caption_url:
+                subtitles = {
+                    'en': [{
+                        'url': caption_url,
+                    }]
+                }
+
             entries.append({
                 'id': compat_str(video_info['id']),
                 'formats': formats,
@@ -124,6 +134,7 @@ class DiscoveryIE(InfoExtractor):
                 'thumbnail': video_info.get('thumbnailURL'),
                 'alt_title': video_info.get('secondary_title'),
                 'timestamp': parse_iso8601(video_info.get('publishedDate')),
+                'subtitles': subtitles,
             })
 
         return self.playlist_result(entries, display_id, video_title)