From: Sergey M. Date: Mon, 3 Feb 2014 13:02:58 +0000 (+0700) Subject: [vimeo] Add support for subtitles (Closes #2239) X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=1eac553e7e32006bcaa2ea4e478b284d3c1182bf;p=youtube-dl [vimeo] Add support for subtitles (Closes #2239) --- 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, }