From bf4aa73fb701554b4fd58cb71ed39bd8868783e8 Mon Sep 17 00:00:00 2001 From: kclauhk <78251477+kclauhk@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:12:58 +0800 Subject: [PATCH] add ffmpeg argument to avoid keepalive request failure in downloading live video --- yt_dlp/extractor/meritplus.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/meritplus.py b/yt_dlp/extractor/meritplus.py index 0fed20872..fb0c0a568 100644 --- a/yt_dlp/extractor/meritplus.py +++ b/yt_dlp/extractor/meritplus.py @@ -96,11 +96,15 @@ def _real_extract(self, url): 'url': caption.get('file'), 'name': caption.get('label'), }) + is_live = bool(video.get('is_live')) for source in video.get('sources', []): if media_url := url_or_none(source.get('file')): if determine_ext(media_url) == 'm3u8': hls_fmts, hls_subs = self._extract_m3u8_formats_and_subtitles( media_url, video['mediaid'], fatal=None) + if is_live: + for f in hls_fmts: + f['downloader_options'] = {'ffmpeg_args_out': ['-http_persistent', '0']} formats.extend(hls_fmts) self._merge_subtitles(hls_subs, target=subtitles) else: @@ -127,10 +131,10 @@ def _real_extract(self, url): 'episode_number': ('episodeNumber', {int_or_none}), 'cast': ('cast', {lambda v: v.split(',') if v else None}), 'duration': ('duration', {float_or_none}), - 'is_live': ('is_live', {lambda v: bool(v)}), 'webpage_url': ('mediaid', {lambda v: url + (f'?episodeId={v}' if v not in url else '')}), 'thumbnail': ('image', {lambda v: url_or_none(v) if not thumbnails else None}), }), + 'is_live': is_live, 'thumbnails': thumbnails, 'formats': formats, 'subtitles': subtitles,