From 5a41dfbdaa729891a00b4d3cb88d4180836c98cd Mon Sep 17 00:00:00 2001 From: Rafael Moraes <50295204+glomatico@users.noreply.github.com> Date: Sat, 23 May 2026 22:54:48 -0300 Subject: [PATCH] Handle missing m3u8 master URL --- gamdl/interface/music_video.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gamdl/interface/music_video.py b/gamdl/interface/music_video.py index 5680a7f..f8ebffa 100644 --- a/gamdl/interface/music_video.py +++ b/gamdl/interface/music_video.py @@ -168,7 +168,7 @@ class AppleMusicMusicVideoInterface: async def _get_stream_info( self, - m3u8_master_url: str, + m3u8_master_url: str | None, codec: MusicVideoCodec, ) -> StreamInfoAv | None: log = logger.bind( @@ -177,6 +177,10 @@ class AppleMusicMusicVideoInterface: codec=codec.value, ) + if not m3u8_master_url: + log.debug("no_m3u8_master_url") + return None + playlist_master_m3u8_obj = m3u8.loads( (await self.base.get_response(m3u8_master_url)).text ) @@ -385,12 +389,11 @@ class AppleMusicMusicVideoInterface: ) -> StreamInfoAv: stream_info = None - if m3u8_master_url: - for codec in self.codec_priority: - stream_info = await self._get_stream_info(m3u8_master_url, codec) + for codec in self.codec_priority: + stream_info = await self._get_stream_info(m3u8_master_url, codec) - if stream_info: - break + if stream_info: + break if not stream_info: raise GamdlInterfaceFormatNotAvailableError(