1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 18:34:32 +01:00

Add hardcoded swedish subs to tv4 extractor

If anyone know how to extract it dynamically then feel free to give me a tip or improve it before merging it in.

# The subtitles are defined in the manifest_url like this:
        # # SUBTITLES groups
        # #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="textstream",NAME="Swedish",LANGUAGE="sv",AUTOSELECT=YES,DEFAULT=YES,URI="bmetgl4z0mr(12579349_ISMUSP)-textstream_swe=3000.m3u8"
        # but I don't know yet how to extract it dynamically from there so they are hardcoded as a start.
This commit is contained in:
swedebugia 2020-04-19 23:49:40 +02:00 committed by GitHub
parent 00eb865b3c
commit 08d06c8f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,11 +107,21 @@ class TV4IE(InfoExtractor):
self._sort_formats(formats)
# The subtitles are defined in the manifest_url like this:
# # SUBTITLES groups
# #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="textstream",NAME="Swedish",LANGUAGE="sv",AUTOSELECT=YES,DEFAULT=YES,URI="bmetgl4z0mr(12579349_ISMUSP)-textstream_swe=3000.m3u8"
# but I don't know yet how to extract it dynamically from there so they are hardcoded as a start.
hardcoded_swedish_subs_url = manifest_url[:-5] + "-textstream_swe=3000.webvtt"
subtitles = {}
subtitles.setdefault('sv', []).append({
'url': hardcoded_swedish_subs_url,
'ext': 'vtt'})
return {
'id': video_id,
'title': title,
'formats': formats,
# 'subtitles': subtitles,
'subtitles': subtitles,
'description': info.get('description'),
'timestamp': parse_iso8601(info.get('broadcast_date_time')),
'duration': int_or_none(info.get('duration')),