Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat: enhance error handling for unavailable formats in translate_ytdlp_error function
Tonho9523117d667a
diff --git a/src-tauri/src/core/ytdlp.rs b/src-tauri/src/core/ytdlp.rsindex d62d8460..a4ffce91 100644--- a/src-tauri/src/core/ytdlp.rs+++ b/src-tauri/src/core/ytdlp.rs@@ -1193,6 +1193,9 @@ fn translate_ytdlp_error(stderr: &str) -> anyhow::Error {if lower.contains("nsig extraction failed") || lower.contains("nsig") {return anyhow!("Video extraction failed. Update yt-dlp or try again.");}+ if lower.contains("requested format") && lower.contains("not available") {+ return anyhow!("Requested format is not available. The download will retry with a compatible format.");+ }if lower.contains("video unavailable") || lower.contains("not available") {return anyhow!("Video unavailable or removed.");}@@ -1574,6 +1577,12 @@ mod tests {assert!(err.to_string().contains("unavailable"));}+ #[test]+ fn translate_error_requested_format() {+ let err = translate_ytdlp_error("ERROR: Requested format is not available. Use --list-formats for a list of available formats");+ assert!(err.to_string().contains("Requested format"));+ }+#[test]fn translate_error_private() {let err = translate_ytdlp_error("This is a private video");