Skip to content

Commit

Permalink
[discovery] extract subtitle
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine committed Apr 30, 2016
1 parent 33a1ec9 commit 93f7a31
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions youtube_dl/extractor/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ def _real_extract(self, url):
'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,
Expand All @@ -124,6 +134,7 @@ def _real_extract(self, url):
'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)

0 comments on commit 93f7a31

Please sign in to comment.