From c05a7364af17654b0365c384a702b1415d4f2196 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Fri, 23 Jul 2021 14:47:36 +0200 Subject: [PATCH] hls.parse: fix an issue when audio info is at the end of the file --- lib/svtplay_dl/fetcher/hls.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/svtplay_dl/fetcher/hls.py b/lib/svtplay_dl/fetcher/hls.py index bec12c4..9225d10 100644 --- a/lib/svtplay_dl/fetcher/hls.py +++ b/lib/svtplay_dl/fetcher/hls.py @@ -58,6 +58,7 @@ def _hlsparse(config, text, url, output, **kwargs): codec = kwargs.pop("codec", "h264") media = {} subtitles = {} + videos = {} segments = None if m3u8.master_playlist: @@ -111,12 +112,15 @@ def _hlsparse(config, text, url, output, **kwargs): vcodec = "hevc" if i["CODECS"][:3] == "avc": vcodec = "h264" - if "AUDIO" in i and (i["AUDIO"] in media): + if "AUDIO" in i: audio_group = i["AUDIO"] urls = get_full_url(i["URI"], url) + videos[bit_rate] = [urls, resolution, vcodec, audio_group] else: continue # Needs to be changed to utilise other tags. + for bit_rate in list(videos.keys()): + urls, resolution, vcodec, audio_group = videos[bit_rate] if audio_group: for group in media[audio_group]: audio_url = get_full_url(group[0], url)