1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[downloader:ytdl] prevent crash in '_progress_hook()'

https://github.com/mikf/gallery-dl/discussions/1964#discussioncomment-1516702
This commit is contained in:
Mike Fährmann 2021-10-21 22:57:04 +02:00
parent bcbf9bcf36
commit 232ab626a7
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -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"]),
)