From 232ab626a7ff8e1525b846f791f91e6c9e6230ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 21 Oct 2021 22:57:04 +0200 Subject: [PATCH] [downloader:ytdl] prevent crash in '_progress_hook()' https://github.com/mikf/gallery-dl/discussions/1964#discussioncomment-1516702 --- 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 86e247b7..f4d3e05f 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -136,8 +136,9 @@ class YoutubeDLDownloader(DownloaderBase): def _progress_hook(self, info): if info["status"] == "downloading" and \ info["elapsed"] >= self.progress: + total = info.get("total_bytes") or info.get("total_bytes_estimate") self.out.progress( - info["total_bytes"], + None if total is None else int(total), info["downloaded_bytes"], int(info["speed"]), )