aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix S <felix.von.s@posteo.de>2021-04-18 15:47:49 +0200
committerFelix S <felix.von.s@posteo.de>2021-04-28 17:23:47 +0530
commitb2cd5da460d4ee2d376f0af68bdaadce93d0dd58 (patch)
treef30aa23bf8c3ca2be806f740f44fb5538fc3288c
parent2de3b21e05a619047ca4ae5af7932cca0ae3a5cb (diff)
downloadhypervideo-pre-b2cd5da460d4ee2d376f0af68bdaadce93d0dd58.tar.lz
hypervideo-pre-b2cd5da460d4ee2d376f0af68bdaadce93d0dd58.tar.xz
hypervideo-pre-b2cd5da460d4ee2d376f0af68bdaadce93d0dd58.zip
[francetv] Extract subtitles from the HLS manifest
-rw-r--r--yt_dlp/extractor/francetv.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/yt_dlp/extractor/francetv.py b/yt_dlp/extractor/francetv.py
index 313de343e..e57e165fc 100644
--- a/yt_dlp/extractor/francetv.py
+++ b/yt_dlp/extractor/francetv.py
@@ -151,6 +151,7 @@ class FranceTVIE(InfoExtractor):
videos.append(fallback_info['video'])
formats = []
+ subtitles = {}
for video in videos:
video_url = video.get('url')
if not video_url:
@@ -171,10 +172,12 @@ class FranceTVIE(InfoExtractor):
sign(video_url, format_id) + '&hdcore=3.7.0&plugin=aasp-3.7.0.39.44',
video_id, f4m_id=format_id, fatal=False))
elif ext == 'm3u8':
- formats.extend(self._extract_m3u8_formats(
+ m3u8_fmts, m3u8_subs = self._extract_m3u8_formats_and_subtitles(
sign(video_url, format_id), video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id=format_id,
- fatal=False))
+ fatal=False)
+ formats.extend(m3u8_fmts)
+ subtitles = self._merge_subtitles(subtitles, m3u8_subs)
elif ext == 'mpd':
formats.extend(self._extract_mpd_formats(
sign(video_url, format_id), video_id, mpd_id=format_id, fatal=False))
@@ -199,13 +202,12 @@ class FranceTVIE(InfoExtractor):
title += ' - %s' % subtitle
title = title.strip()
- subtitles = {}
- subtitles_list = [{
- 'url': subformat['url'],
- 'ext': subformat.get('format'),
- } for subformat in info.get('subtitles', []) if subformat.get('url')]
- if subtitles_list:
- subtitles['fr'] = subtitles_list
+ subtitles.setdefault('fr', []).extend(
+ [{
+ 'url': subformat['url'],
+ 'ext': subformat.get('format'),
+ } for subformat in info.get('subtitles', []) if subformat.get('url')]
+ )
return {
'id': video_id,