diff options
author | Sergey M. <dstftw@gmail.com> | 2014-02-03 20:02:58 +0700 |
---|---|---|
committer | Sergey M. <dstftw@gmail.com> | 2014-02-03 20:02:58 +0700 |
commit | 1eac553e7e32006bcaa2ea4e478b284d3c1182bf (patch) | |
tree | 18ddf9ede5b4f0c2fccc24c7d0da6b8624668050 /youtube_dl | |
parent | 9d3ac7444da966788e08490562ea6b6678f23abf (diff) |
[vimeo] Add support for subtitles (Closes #2239)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/vimeo.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/youtube_dl/extractor/vimeo.py b/youtube_dl/extractor/vimeo.py index a50170ce7..0f10c8917 100644 --- a/youtube_dl/extractor/vimeo.py +++ b/youtube_dl/extractor/vimeo.py @@ -6,6 +6,7 @@ import re import itertools from .common import InfoExtractor +from .subtitles import SubtitlesInfoExtractor from ..utils import ( compat_urllib_parse, compat_urllib_request, @@ -19,7 +20,7 @@ from ..utils import ( ) -class VimeoIE(InfoExtractor): +class VimeoIE(SubtitlesInfoExtractor): """Information extractor for vimeo.com.""" # _VALID_URL matches Vimeo URLs @@ -84,6 +85,20 @@ class VimeoIE(InfoExtractor): 'videopassword': 'youtube-dl', }, }, + { + 'url': 'http://vimeo.com/76979871', + 'md5': '3363dd6ffebe3784d56f4132317fd446', + 'note': 'Video with subtitles', + 'info_dict': { + 'id': '76979871', + 'ext': 'mp4', + 'title': 'The New Vimeo Player (You Know, For Videos)', + 'description': 'md5:2ec900bf97c3f389378a96aee11260ea', + 'upload_date': '20131015', + 'uploader_id': 'staff', + 'uploader': 'Vimeo Staff', + } + }, ] def _login(self): @@ -273,6 +288,17 @@ class VimeoIE(InfoExtractor): if len(formats) == 0: raise ExtractorError('No known codec found') + subtitles = {} + text_tracks = config['request'].get('text_tracks') + if text_tracks: + for tt in text_tracks: + subtitles[tt['lang']] = 'http://vimeo.com' + tt['url'] + + video_subtitles = self.extract_subtitles(video_id, subtitles) + if self._downloader.params.get('listsubtitles', False): + self._list_available_subtitles(video_id, subtitles) + return + return { 'id': video_id, 'uploader': video_uploader, @@ -286,6 +312,7 @@ class VimeoIE(InfoExtractor): 'view_count': view_count, 'like_count': like_count, 'comment_count': comment_count, + 'subtitles': video_subtitles, } |