-
- def extract_subtitles(self, video_id, video_webpage=None):
- """
- Extract the subtitles and/or the automatic captions if requested.
- Returns None or a dictionary in the format {sub_lang: sub}
- """
- video_subtitles = None
- if self._downloader.params.get('writesubtitles', False) or self._downloader.params.get('allsubtitles', False):
- video_subtitles = self._extract_subtitles(video_id)
- elif self._downloader.params.get('writeautomaticsub', False):
- video_subtitles = self._request_automatic_caption(video_id, video_webpage)
- return video_subtitles