tonhowtf/omniget · error

nao reconheci um video do YouTube em

Error message

nao reconheci um video do YouTube em: {}

What it means

ryd::votes() extracts a YouTube video id from the input using sponsorblock::video_id(). If the input does not contain a recognizable YouTube video URL, shorts URL, youtu.be link, or bare 11-character id, it raises this error before any network call.

Solutions

  1. Pass a canonical watch URL: https://www.youtube.com/watch?v=<11-char-id>
  2. Or pass the bare 11-character video id directly
  3. Strip surrounding text/trackers and confirm the id is exactly 11 base64-url characters
  4. Check video_id()'s accepted patterns if using an uncommon YouTube URL form (e.g. live or embed)

Example fix

// before
votes("https://www.youtube.com/playlist?list=PL123").await?; // not a video
// after
votes("https://www.youtube.com/watch?v=dQw4w9WgXcQ").await?;
Defensive patterns

Strategy: validation

Validate before calling

const ID_RE: &str = r"(?:youtube\.com/(?:watch\?v=|shorts/|embed/)|youtu\.be/)?([A-Za-z0-9_-]{11})";
fn extract_video_id(u: &str) -> Option<&str> {
    regex::Regex::new(ID_RE).ok()?.captures(u)?.get(1).map(|m| m.as_str())
}
if extract_video_id(input).is_none() { eprintln!("not a YouTube video: {}", input); }

Type guard

fn is_youtube_video_url(u: &str) -> bool {
    u.contains("youtube.com/watch") || u.contains("youtu.be/") || u.contains("youtube.com/shorts/")
}

Try / catch

match ryd::votes(input).await {
    Ok(v) => handle(v),
    Err(e) if e.to_string().contains("nao reconheci") => {
        eprintln!("{} is not a YouTube video id/URL", input);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Passing a non-YouTube URL (Vimeo, direct file URL), a YouTube channel/playlist URL, a search-results link, an id shorter/longer than 11 chars, or text with no URL at all to ryd::votes().

Common situations: Users paste a youtube.com/watch URL with extra tracking params plus surrounding text and an unusual form the extractor misses; passing a playlist link; typos truncating the video id.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/ryd.rs:27

pub struct Votes {
    pub id: String,
    #[serde(rename = "dateCreated", default)]
    pub date_created: String,
    #[serde(default)]
    pub likes: u64,
    #[serde(default)]
    pub dislikes: u64,
    #[serde(default)]
    pub rating: f64,
    #[serde(rename = "viewCount", default)]
    pub view_count: u64,
    #[serde(default)]
    pub deleted: bool,
}

pub async fn votes(input: &str) -> anyhow::Result<Votes> {
    let id = super::sponsorblock::video_id(input)
        .ok_or_else(|| anyhow!("nao reconheci um video do YouTube em: {}", input))?;
    let client = super::client()?;
    let resp = client
        .get(format!("{}/votes?videoId={}", API, id))
        .send()
        .await?;
    if !resp.status().is_success() {
        return Err(anyhow!("Return YouTube Dislike: HTTP {}", resp.status()));
    }
    Ok(resp.json().await?)
}

View on GitHub (pinned to 8600b91f42)