From 19403a7fffd65a361912ac7917a5597568537857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 12 Nov 2021 17:35:53 +0100 Subject: [PATCH] [downloader:ytdl] prevent crash in '_progress_hook()' (#1680) 'speed' is not guaranteed to be defined or convertible to 'int' --- gallery_dl/downloader/ytdl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index b1239bbb..8416ca07 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -121,10 +121,11 @@ class YoutubeDLDownloader(DownloaderBase): if info["status"] == "downloading" and \ info["elapsed"] >= self.progress: total = info.get("total_bytes") or info.get("total_bytes_estimate") + speed = info.get("speed") self.out.progress( None if total is None else int(total), info["downloaded_bytes"], - int(info["speed"]), + int(speed) if speed else 0, ) @staticmethod