From 51681d1294c9dd0a530a01d6cad0468a1524e0a5 Mon Sep 17 00:00:00 2001 From: Mozi <29089388+pzhlkj6612@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:17:54 +0000 Subject: [PATCH] [ie/niconico] Use "network_exceptions"; add errnote for m3u8 download --- yt_dlp/downloader/niconico.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yt_dlp/downloader/niconico.py b/yt_dlp/downloader/niconico.py index 7011d83e2..f50e89ac2 100644 --- a/yt_dlp/downloader/niconico.py +++ b/yt_dlp/downloader/niconico.py @@ -9,7 +9,7 @@ from .external import FFmpegFD from ..downloader.hls import HlsFD from ..networking import Request -from ..networking.exceptions import RequestError +from ..networking.exceptions import network_exceptions from ..utils import ( DownloadError, RetryManager, @@ -233,7 +233,8 @@ def real_download(self, filename, info_dict): raise DownloadError('Unable to get playlist') # Get all fragments - media_m3u8 = ie._download_webpage(media_m3u8_url, video_id, note=False) + media_m3u8 = ie._download_webpage( + media_m3u8_url, video_id, note=False, errnote='Unable to download media m3u8') fragment_urls = traverse_obj(media_m3u8.splitlines(), ( lambda _, v: not v.startswith('#'), {lambda url: urljoin(media_m3u8_url, url)})) @@ -245,7 +246,7 @@ def real_download(self, filename, info_dict): self._append_fragment(ctx, self._read_fragment(ctx)) downloaded_duration += fragment_duration - except (DownloadError, RequestError) as err: # Including HTTPError and TransportError + except (DownloadError, *network_exceptions) as err: retry.error = err continue