From 09d18ad07ea6311b7861eb77dcaa5a13f9d64fe1 Mon Sep 17 00:00:00 2001 From: Ashish <39122144+Ashish0804@users.noreply.github.com> Date: Sun, 23 May 2021 21:26:27 +0530 Subject: [PATCH] [Sonyliv] Add subtitle support (#342) Authored by: Ashish0804 --- yt_dlp/extractor/sonyliv.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/sonyliv.py b/yt_dlp/extractor/sonyliv.py index ec7b4f37f..60181f06d 100644 --- a/yt_dlp/extractor/sonyliv.py +++ b/yt_dlp/extractor/sonyliv.py @@ -100,7 +100,14 @@ def _real_extract(self, url): metadata = self._call_api( '1.6', 'IN/DETAIL/' + video_id, video_id)['containers'][0]['metadata'] title = metadata['episodeTitle'] - + subtitles = {} + for sub in content.get('subtitle', []): + sub_url = sub.get('subtitleUrl') + if not sub_url: + continue + subtitles.setdefault(sub.get('subtitleLanguageName', 'ENG'), []).append({ + 'url': sub_url, + }) return { 'id': video_id, 'title': title, @@ -113,6 +120,7 @@ def _real_extract(self, url): 'series': metadata.get('title'), 'episode_number': int_or_none(metadata.get('episodeNumber')), 'release_year': int_or_none(metadata.get('year')), + 'subtitles': subtitles, }