tonhowtf/omniget · error

YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp

Error message

YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp: {}

What it means

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.

Solutions

  1. Install yt-dlp and ensure it is on PATH (pip install yt-dlp or the official binary).
  2. Read the embedded cause ('Falha ao obter yt-dlp: {}') to identify download vs permission vs execution failure.
  3. Ensure network connectivity so the app can auto-download yt-dlp.
  4. Grant write permission to the directory where the app stores yt-dlp.
  5. Update yt-dlp regularly — YouTube breaks old versions frequently.

Example fix

// before
let ytdlp_path = ytdlp::ensure_ytdlp().await.map_err(|e| {
    anyhow!("YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp: {}", e)
})?;
// after: prefer a user-configured binary
let ytdlp_path = match std::env::var_os("YTDLP_PATH") {
    Some(p) => std::path::PathBuf::from(p),
    None => ytdlp::ensure_ytdlp().await.map_err(|e| {
        anyhow!("YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp: {}", e)
    })?,
};
Defensive patterns

Strategy: validation

Validate before calling

// ensure yt-dlp is provisioned before any YouTube call
let ytdlp_path = match ytdlp::ensure_ytdlp().await {
    Ok(p) => p,
    Err(e) => { eprintln!("install yt-dlp first: {}", e); return; }
};

Type guard

fn ytdlp_ready(path: &std::path::Path) -> bool {
    path.exists() && std::fs::metadata(path).map(|m| m.len() > 0).unwrap_or(false)
}

Try / catch

match downloader.get_media_info(&youtube_url).await {
    Err(e) if e.to_string().contains("requer yt-dlp") => {
        // run first-time setup: download yt-dlp, verify PATH, then retry
        run_ytdlp_setup_wizard().await?;
        downloader.get_media_info(&youtube_url).await
    }
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/f4531ce5950afa5c. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/youtube/mod.rs:272

    }

    fn can_handle(&self, url: &str) -> bool {
        if let Ok(parsed) = url::Url::parse(url) {
            if let Some(host) = parsed.host_str() {
                let host = host.to_lowercase();
                return host == "youtube.com"
                    || host.ends_with(".youtube.com")
                    || host == "youtu.be"
                    || host == "youtube-nocookie.com"
                    || host.ends_with(".youtube-nocookie.com");
            }
        }
        false
    }

    async fn get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {
        let ytdlp_path = ytdlp::ensure_ytdlp().await.map_err(|e| {
            anyhow!(
                "YouTube requer yt-dlp para funcionar. Falha ao obter yt-dlp: {}",
                e
            )
        })?;

        if Self::is_playlist_url(url) {
            let (playlist_title, entries) = ytdlp::get_playlist_info(&ytdlp_path, url, &[]).await?;

            if entries.is_empty() {
                return Err(anyhow!("Playlist empty or unavailable"));
            }

            let qualities: Vec<MediaVideoQuality> = entries
                .into_iter()
                .enumerate()
                .map(|(i, entry)| MediaVideoQuality {
                    label: format!("{}. {}", i + 1, entry.title),
                    width: 0,

View on GitHub (pinned to 8600b91f42)