diff options
| author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2015-02-16 21:44:17 +0100 | 
|---|---|---|
| committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2015-02-16 22:47:39 +0100 | 
| commit | 360e1ca5ccabcb5d48228d9472b09f1bce68bbc4 (patch) | |
| tree | b97ea029201d0a74f2574ed7aa9e81bb9a022d4b /youtube_dl/extractor/common.py | |
| parent | a1f2a06b34807a2e1b5eb5176fa418da2405392d (diff) | |
[youtube] Convert to new subtitles system
The automatic captions are stored in the 'automactic_captions' field, which is used if no normal subtitles are found for an specific language.
Diffstat (limited to 'youtube_dl/extractor/common.py')
| -rw-r--r-- | youtube_dl/extractor/common.py | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index d149e0f92..fe7d8dbc9 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -157,6 +157,8 @@ class InfoExtractor(object):                      with the "ext" entry and one of:                          * "data": The subtitles file contents                          * "url": A url pointing to the subtitles file +    automatic_captions: Like 'subtitles', used by the YoutubeIE for +                    automatically generated captions      duration:       Length of the video in seconds, as an integer.      view_count:     How many users have watched the video on the platform.      like_count:     Number of positive ratings of the video @@ -1007,6 +1009,16 @@ class InfoExtractor(object):      def _get_subtitles(self, *args, **kwargs):          raise NotImplementedError("This method must be implemented by subclasses") +    def extract_automatic_captions(self, *args, **kwargs): +        automatic_captions = {} +        list_subtitles = self._downloader.params.get('listsubtitles') +        if self._downloader.params.get('writeautomaticsub', False) or list_subtitles: +            automatic_captions.update(self._get_automatic_captions(*args, **kwargs)) +        return automatic_captions + +    def _get_automatic_captions(self, *args, **kwargs): +        raise NotImplementedError("This method must be implemented by subclasses") +  class SearchInfoExtractor(InfoExtractor):      """ | 
