From 922680a9dc586389ddbc9491c531199c41a5c758 Mon Sep 17 00:00:00 2001 From: Aniruddh Joshi Date: Thu, 14 Oct 2021 12:20:35 +0530 Subject: [PATCH] Add subtitles download for SonyLIV --- youtube_dl/extractor/sonyliv.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/youtube_dl/extractor/sonyliv.py b/youtube_dl/extractor/sonyliv.py index fedfceb62..dfe99c9af 100644 --- a/youtube_dl/extractor/sonyliv.py +++ b/youtube_dl/extractor/sonyliv.py @@ -96,6 +96,19 @@ class SonyLIVIE(InfoExtractor): episode = metadata.get('episodeTitle') if episode and title != episode: title += ' - ' + episode + + subtitles = {} + for subtitle in (content.get('subtitle') or []): + base_url = subtitle.get('subtitleUrl') + if not base_url: + continue + lang_code = subtitle.get('subtitleLanguageName') + if not lang_code: + continue + subtitles[lang_code] = [{ + 'ext': 'vtt', + 'url': base_url, + }] return { 'id': video_id, @@ -109,4 +122,5 @@ class SonyLIVIE(InfoExtractor): 'episode': episode, 'episode_number': int_or_none(metadata.get('episodeNumber')), 'release_year': int_or_none(metadata.get('year')), + 'subtitles': subtitles }