1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-25 17:27:36 +00:00

[subtitles] Also list the available automatic captions languages with '--list-sub'

This commit is contained in:
Jaime Marquínez Ferrándiz 2013-09-11 19:17:30 +02:00
parent 055e6f3657
commit d665f8d3cb
2 changed files with 6 additions and 2 deletions

View file

@ -8,12 +8,16 @@ from ..utils import (
class SubtitlesInfoExtractor(InfoExtractor): class SubtitlesInfoExtractor(InfoExtractor):
def _list_available_subtitles(self, video_id): def _list_available_subtitles(self, video_id, webpage=None):
""" outputs the available subtitles for the video """ """ outputs the available subtitles for the video """
sub_lang_list = self._get_available_subtitles(video_id) sub_lang_list = self._get_available_subtitles(video_id)
auto_captions_list = self._get_available_automatic_caption(video_id, webpage)
sub_lang = ",".join(list(sub_lang_list.keys())) sub_lang = ",".join(list(sub_lang_list.keys()))
self.to_screen(u'%s: Available subtitles for video: %s' % self.to_screen(u'%s: Available subtitles for video: %s' %
(video_id, sub_lang)) (video_id, sub_lang))
auto_lang = ",".join(auto_captions_list.keys())
self.to_screen(u'%s: Available automatic captions for video: %s' %
(video_id, auto_lang))
def extract_subtitles(self, video_id, video_webpage=None): def extract_subtitles(self, video_id, video_webpage=None):
""" returns {sub_lang: sub} or {} if subtitles not found """ """ returns {sub_lang: sub} or {} if subtitles not found """

View file

@ -724,7 +724,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
video_subtitles = self.extract_subtitles(video_id, video_webpage) video_subtitles = self.extract_subtitles(video_id, video_webpage)
if self._downloader.params.get('listsubtitles', False): if self._downloader.params.get('listsubtitles', False):
self._list_available_subtitles(video_id) self._list_available_subtitles(video_id, video_webpage)
return return
if 'length_seconds' not in video_info: if 'length_seconds' not in video_info: