{"record":{"id":"f4531ce5950afa5c","repo":"tonhowtf/omniget","slug":"youtube-requer-yt-dlp-para-funcionar-falha-ao-obter-yt-dlp","errorCode":null,"errorMessage":"YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp: {}","messagePattern":"YouTube requer yt-dlp para funcionar\\. Falha ao obter yt-dlp: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/youtube/mod.rs","lineNumber":272,"sourceCode":"    }\n\n    fn can_handle(&self, url: &str) -> bool {\n        if let Ok(parsed) = url::Url::parse(url) {\n            if let Some(host) = parsed.host_str() {\n                let host = host.to_lowercase();\n                return host == \"youtube.com\"\n                    || host.ends_with(\".youtube.com\")\n                    || host == \"youtu.be\"\n                    || host == \"youtube-nocookie.com\"\n                    || host.ends_with(\".youtube-nocookie.com\");\n            }\n        }\n        false\n    }\n\n    async fn get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {\n        let ytdlp_path = ytdlp::ensure_ytdlp().await.map_err(|e| {\n            anyhow!(\n                \"YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp: {}\",\n                e\n            )\n        })?;\n\n        if Self::is_playlist_url(url) {\n            let (playlist_title, entries) = ytdlp::get_playlist_info(&ytdlp_path, url, &[]).await?;\n\n            if entries.is_empty() {\n                return Err(anyhow!(\"Playlist empty or unavailable\"));\n            }\n\n            let qualities: Vec<MediaVideoQuality> = entries\n                .into_iter()\n                .enumerate()\n                .map(|(i, entry)| MediaVideoQuality {\n                    label: format!(\"{}. {}\", i + 1, entry.title),\n                    width: 0,","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/youtube/mod.rs#L254-L290","documentation":"Thrown by YouTubeDownloader::get_media_info when ytdlp::ensure_ytdlp() fails — the yt-dlp binary is missing and could not be provisioned. YouTube extraction in this codebase depends on yt-dlp, so without it nothing can proceed. The underlying ensure_ytdlp error is embedded in the message.","triggerScenarios":"Calling get_media_info (or download) on a YouTube URL when ensure_ytdlp fails: binary not installed and not on PATH, auto-download fails due to no network or no write permission, or the binary is blocked by the OS.","commonSituations":"First run on a machine without yt-dlp while offline; sandboxed or read-only install directories; antivirus quarantine of the downloaded binary; corrupted yt-dlp installation.","solutions":["Install yt-dlp and ensure it is on PATH (pip install yt-dlp or the official binary).","Read the embedded cause ('Falha ao obter yt-dlp: {}') to identify download vs permission vs execution failure.","Ensure network connectivity so the app can auto-download yt-dlp.","Grant write permission to the directory where the app stores yt-dlp.","Update yt-dlp regularly — YouTube breaks old versions frequently."],"exampleFix":"// before\nlet ytdlp_path = ytdlp::ensure_ytdlp().await.map_err(|e| {\n    anyhow!(\"YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp: {}\", e)\n})?;\n// after: prefer a user-configured binary\nlet ytdlp_path = match std::env::var_os(\"YTDLP_PATH\") {\n    Some(p) => std::path::PathBuf::from(p),\n    None => ytdlp::ensure_ytdlp().await.map_err(|e| {\n        anyhow!(\"YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp: {}\", e)\n    })?,\n};","handlingStrategy":"validation","validationCode":"// ensure yt-dlp is provisioned before any YouTube call\nlet ytdlp_path = match ytdlp::ensure_ytdlp().await {\n    Ok(p) => p,\n    Err(e) => { eprintln!(\"install yt-dlp first: {}\", e); return; }\n};","typeGuard":"fn ytdlp_ready(path: &std::path::Path) -> bool {\n    path.exists() && std::fs::metadata(path).map(|m| m.len() > 0).unwrap_or(false)\n}","tryCatchPattern":"match downloader.get_media_info(&youtube_url).await {\n    Err(e) if e.to_string().contains(\"requer yt-dlp\") => {\n        // run first-time setup: download yt-dlp, verify PATH, then retry\n        run_ytdlp_setup_wizard().await?;\n        downloader.get_media_info(&youtube_url).await\n    }\n    other => other,\n}","preventionTips":["Run a setup check at app startup that verifies yt-dlp presence.","Keep the machine online for first-run auto-download of yt-dlp.","Ensure the yt-dlp storage directory is writable.","Update yt-dlp frequently — YouTube breaks old versions often.","Allow users to point to a custom yt-dlp binary via config/env."],"tags":["dependency","ytdlp","youtube","setup"],"backgroundTag":"missing-dependency","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}