From a459661fa2edd34f799c0c52ee777e1b3a5dc7d0 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 4 Mar 2023 11:51:12 +0700 Subject: [PATCH] fallback to estimate size for progress hook --- tubearchivist/home/src/download/yt_dlp_handler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tubearchivist/home/src/download/yt_dlp_handler.py b/tubearchivist/home/src/download/yt_dlp_handler.py index 4f1fbced..eb9dd96b 100644 --- a/tubearchivist/home/src/download/yt_dlp_handler.py +++ b/tubearchivist/home/src/download/yt_dlp_handler.py @@ -293,8 +293,11 @@ class VideoDownloader: title = "Downloading: " + response["info_dict"]["title"] try: + size = response.get("_total_bytes_str") + if size.strip() == "N/A": + size = response.get("_total_bytes_estimate_str", "N/A") + percent = response["_percent_str"] - size = response["_total_bytes_str"] speed = response["_speed_str"] eta = response["_eta_str"] message = f"{percent} of {size} at {speed} - time left: {eta}"