{"record":{"id":"9dc8100a21c42080","repo":"tonhowtf/omniget","slug":"o-yt-dlp-n-o-est-dispon-vel-mod","errorCode":null,"errorMessage":"o yt-dlp não está disponível: {}","messagePattern":"o yt-dlp não está disponível: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/tiktok/mod.rs","lineNumber":670,"sourceCode":"    let line = line\n        .trim_start_matches(\"ERROR:\")\n        .trim_start_matches(\"WARNING:\")\n        .trim();\n    let line = match line.split_once(\"] \") {\n        Some((head, rest)) if head.starts_with('[') => rest,\n        _ => line,\n    };\n    let mut s: String = line.chars().take(220).collect();\n    if s.is_empty() {\n        s = \"o yt-dlp não baixou nada\".to_string();\n    }\n    s\n}\n\nasync fn ytdlp_binary() -> Result<PathBuf> {\n    crate::core::ytdlp::ensure_ytdlp()\n        .await\n        .map_err(|e| anyhow!(\"o yt-dlp não está disponível: {}\", e))\n}\n\n/// Roda o yt-dlp e devolve (arquivos criados, últimas linhas de erro).\npub async fn run_ytdlp(\n    args: &[String],\n    id: &str,\n    progress: &ProgressFn,\n) -> Result<(Vec<String>, String)> {\n    use tokio::io::{AsyncBufReadExt, BufReader};\n    let bin = ytdlp_binary().await?;\n    let mut cmd = crate::core::ytdlp::ytdlp_command(&bin);\n    cmd.args(args)\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::piped())\n        .stderr(std::process::Stdio::piped());\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow!(\"não foi possível iniciar o yt-dlp: {}\", e))?;","sourceCodeStart":652,"sourceCodeEnd":688,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/tiktok/mod.rs#L652-L688","documentation":"`ytdlp_binary` wraps `crate::core::ytdlp::ensure_ytdlp()`, which locates or installs the external yt-dlp executable. When that fails (binary absent, download of it failed, no network, unsupported platform), the error is re-wrapped with \"o yt-dlp não está disponível\". It signals that the TikTok tooling cannot proceed without the external dependency.","triggerScenarios":"Calling `run_ytdlp` or `ytdlp_json` when yt-dlp is not on PATH and ensure_ytdlp cannot provision it; ensure_ytdlp's install step fails due to network loss or a missing Python runtime; PATH is stripped in the spawned environment.","commonSituations":"Fresh machine or CI container without yt-dlp installed; user deleted the cached binary; corporate proxy blocks the download of yt-dlp; packaged app ships without bundling yt-dlp.","solutions":["Install yt-dlp (pip install yt-dlp, package manager, or download the standalone binary) and ensure it is on PATH.","Run the app once with network access so ensure_ytdlp can fetch the binary into its cache.","Check the inner error `e` in the message for the precise provisioning failure (network, permissions, Python missing).","Bundle yt-dlp with the app or point the ytdlp config at an explicit binary path."],"exampleFix":"// before (CI failing because yt-dlp is absent)\n- run: cargo test\n// after\n- run: pip install yt-dlp\n- run: cargo test","handlingStrategy":"fallback","validationCode":"// Pre-flight check before calling run_ytdlp/ytdlp_json\nlet ok = tokio::process::Command::new(\"yt-dlp\").arg(\"--version\").output().await.map(|o| o.status.success()).unwrap_or(false);","typeGuard":null,"tryCatchPattern":"match ytdlp_binary().await {\n    Ok(path) => run_download(&path).await,\n    Err(e) => show_install_instructions(&e), // \"install yt-dlp / check network\"\n}","preventionTips":["Install yt-dlp and keep it updated (`pip install -U yt-dlp`).","In packaged apps, bundle yt-dlp instead of relying on PATH.","Run a --version preflight at app startup and surface a clear setup screen if missing."],"tags":["dependency","external-binary","ytdlp"],"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"}