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

'speed' is not guaranteed to be defined or convertible to 'int'
This commit is contained in:
Mike Fährmann
2021-11-12 17:35:53 +01:00
parent 01b28f3674
commit 19403a7fff

View File

@@ -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