mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 02:42:30 +00:00
[vimeo] Add support for subtitles (Closes #2239)
This commit is contained in:
parent
9d3ac7444d
commit
1eac553e7e
@ -6,6 +6,7 @@
|
|||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from .subtitles import SubtitlesInfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
@ -19,7 +20,7 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class VimeoIE(InfoExtractor):
|
class VimeoIE(SubtitlesInfoExtractor):
|
||||||
"""Information extractor for vimeo.com."""
|
"""Information extractor for vimeo.com."""
|
||||||
|
|
||||||
# _VALID_URL matches Vimeo URLs
|
# _VALID_URL matches Vimeo URLs
|
||||||
@ -84,6 +85,20 @@ class VimeoIE(InfoExtractor):
|
|||||||
'videopassword': 'youtube-dl',
|
'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):
|
def _login(self):
|
||||||
@ -273,6 +288,17 @@ def _real_extract(self, url):
|
|||||||
if len(formats) == 0:
|
if len(formats) == 0:
|
||||||
raise ExtractorError('No known codec found')
|
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 {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'uploader': video_uploader,
|
'uploader': video_uploader,
|
||||||
@ -286,6 +312,7 @@ def _real_extract(self, url):
|
|||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
'like_count': like_count,
|
'like_count': like_count,
|
||||||
'comment_count': comment_count,
|
'comment_count': comment_count,
|
||||||
|
'subtitles': video_subtitles,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user