tonhowtf/omniget · error · anyhow::Error

yt-dlp not found

Error message

yt-dlp not found

What it means

`get_media_info` for Douyin requires the external yt-dlp binary and errors when `ytdlp::find_ytdlp_cached()` returns None. The library shells out to yt-dlp for metadata extraction, so without the binary on PATH (or a cached path) it cannot resolve media info.

Solutions

  1. Install yt-dlp (e.g. `pip install yt-dlp` or `brew install yt-dlp`) so it is on the app's PATH.
  2. Verify with `yt-dlp --version` in the same environment the Tauri app runs in.
  3. Clear/refresh the ytdlp path cache if the binary was moved or upgraded.
  4. Ensure the app's dependency auto-download/update routine ran (check startup logs).
Defensive patterns

Strategy: fallback

Validate before calling

// Rust, before get_media_info
if ytdlp::find_ytdlp_cached().await.is_none() {
    return Err(anyhow!("yt-dlp must be installed before using Douyin extraction"));
}

Try / catch

// Rust
let ytdlp_path = match ytdlp::find_ytdlp_cached().await {
    Some(p) => p,
    None => {
        log::warn!("yt-dlp not found; attempting managed install");
        ytdlp::install_ytdlp().await? // fall back to auto-install
    }
};

Prevention

When it happens

Trigger: Calling Douyin `get_media_info` when yt-dlp is neither at `opts.ytdlp_path`-like configuration nor discoverable via `find_ytdlp_cached` (not installed, not on PATH, or the cache holds a stale/deleted path).

Common situations: Fresh machine/container without yt-dlp installed, yt-dlp installed in a venv not on the app's PATH, yt-dlp upgraded/moved after the cache was populated, or bundled-binary download failed at startup.

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/3c5e2aae9bfa7455. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/douyin/mod.rs:189

#[async_trait]
impl PlatformDownloader for DouyinDownloader {
    fn name(&self) -> &str {
        "douyin"
    }

    fn can_handle(&self, url: &str) -> bool {
        if let Ok(parsed) = url::Url::parse(url) {
            if let Some(host) = parsed.host_str() {
                return Self::host_matches(host);
            }
        }
        false
    }

    async fn get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {
        let ytdlp_path = ytdlp::find_ytdlp_cached()
            .await
            .ok_or_else(|| anyhow!("yt-dlp not found"))?;

        let resolved = Self::resolve_url(url).await;
        let extra = Self::extra_flags();
        let json = ytdlp::get_video_info(&ytdlp_path, &resolved, &extra).await?;

        let title = json
            .get("title")
            .and_then(|v| v.as_str())
            .unwrap_or("Douyin Video")
            .to_string();

        let author = json
            .get("uploader")
            .and_then(|v| v.as_str())
            .or_else(|| json.get("channel").and_then(|v| v.as_str()))
            .unwrap_or("Unknown")
            .to_string();

View on GitHub (pinned to 8600b91f42)