Compare commits

...

6 Commits

Author SHA1 Message Date
Aniruddh Joshi
9ee3364a4d
Merge 3287b4a114 into e1b3fa242c 2024-07-28 01:30:04 +09:00
Aniruddh Joshi
3287b4a114
Fixed compat_str import 2021-10-15 23:37:22 +05:30
Aniruddh Joshi
bef35dfd9b
compat_str req 2021-10-15 10:05:10 +05:30
Aniruddh Joshi
174b795485
Proposed changes 2021-10-15 10:02:17 +05:30
Aniruddh Joshi
30d8bbf6fa
Fix whitespace 2021-10-14 12:32:59 +05:30
Aniruddh Joshi
922680a9dc
Add subtitles download for SonyLIV 2021-10-14 12:20:35 +05:30

View File

@ -5,10 +5,14 @@ import time
import uuid
from .common import InfoExtractor
from ..compat import compat_HTTPError
from ..compat import (
compat_HTTPError,
compat_str
)
from ..utils import (
ExtractorError,
int_or_none,
try_get
)
@ -96,6 +100,18 @@ class SonyLIVIE(InfoExtractor):
episode = metadata.get('episodeTitle')
if episode and title != episode:
title += ' - ' + episode
subtitles = {}
for subtitle in (content.get('subtitle') or []):
base_url = try_get(subtitle, lambda x: x['subtitleUrl'], compat_str)
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 +125,5 @@ class SonyLIVIE(InfoExtractor):
'episode': episode,
'episode_number': int_or_none(metadata.get('episodeNumber')),
'release_year': int_or_none(metadata.get('year')),
'subtitles': subtitles
}