|
|
@ -88,7 +88,7 @@ class SVTBaseIE(InfoExtractor):
|
|
|
|
'id': video_id,
|
|
|
|
'id': video_id,
|
|
|
|
'title': title,
|
|
|
|
'title': title,
|
|
|
|
'formats': formats,
|
|
|
|
'formats': formats,
|
|
|
|
'subtitles': subtitles,
|
|
|
|
'subtitles': self._fixup_subtitles(subtitles),
|
|
|
|
'duration': duration,
|
|
|
|
'duration': duration,
|
|
|
|
'timestamp': timestamp,
|
|
|
|
'timestamp': timestamp,
|
|
|
|
'age_limit': age_limit,
|
|
|
|
'age_limit': age_limit,
|
|
|
@ -99,6 +99,16 @@ class SVTBaseIE(InfoExtractor):
|
|
|
|
'is_live': is_live,
|
|
|
|
'is_live': is_live,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def _fixup_subtitles(subtitles):
|
|
|
|
|
|
|
|
# See: https://github.com/yt-dlp/yt-dlp/issues/14020
|
|
|
|
|
|
|
|
fixed_subtitles = {}
|
|
|
|
|
|
|
|
for lang, subs in subtitles.items():
|
|
|
|
|
|
|
|
for sub in subs:
|
|
|
|
|
|
|
|
fixed_lang = f'{lang}-forced' if 'text-open' in sub['url'] else lang
|
|
|
|
|
|
|
|
fixed_subtitles.setdefault(fixed_lang, []).append(sub)
|
|
|
|
|
|
|
|
return fixed_subtitles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SVTPlayIE(SVTBaseIE):
|
|
|
|
class SVTPlayIE(SVTBaseIE):
|
|
|
|
IE_NAME = 'svt:play'
|
|
|
|
IE_NAME = 'svt:play'
|
|
|
@ -115,6 +125,26 @@ class SVTPlayIE(SVTBaseIE):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
_TESTS = [{
|
|
|
|
_TESTS = [{
|
|
|
|
|
|
|
|
'url': 'https://www.svtplay.se/video/eXYgwZb/sverige-och-kriget/1-utbrottet',
|
|
|
|
|
|
|
|
'md5': '2382036fd6f8c994856c323fe51c426e',
|
|
|
|
|
|
|
|
'info_dict': {
|
|
|
|
|
|
|
|
'id': 'ePBvGRq',
|
|
|
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
|
|
|
'title': '1. Utbrottet',
|
|
|
|
|
|
|
|
'description': 'md5:02291cc3159dbc9aa95d564e77a8a92b',
|
|
|
|
|
|
|
|
'series': 'Sverige och kriget',
|
|
|
|
|
|
|
|
'episode': '1. Utbrottet',
|
|
|
|
|
|
|
|
'timestamp': 1746921600,
|
|
|
|
|
|
|
|
'upload_date': '20250511',
|
|
|
|
|
|
|
|
'duration': 3585,
|
|
|
|
|
|
|
|
'thumbnail': r're:^https?://(?:.*[\.-]jpg|www.svtstatic.se/image/.*)$',
|
|
|
|
|
|
|
|
'age_limit': 0,
|
|
|
|
|
|
|
|
'subtitles': {'sv': 'count:3', 'sv-forced': 'count:3'},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
'params': {
|
|
|
|
|
|
|
|
'skip_download': 'm3u8',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}, {
|
|
|
|
'url': 'https://www.svtplay.se/video/30479064',
|
|
|
|
'url': 'https://www.svtplay.se/video/30479064',
|
|
|
|
'md5': '2382036fd6f8c994856c323fe51c426e',
|
|
|
|
'md5': '2382036fd6f8c994856c323fe51c426e',
|
|
|
|
'info_dict': {
|
|
|
|
'info_dict': {
|
|
|
|