{"record":{"id":"1cc7e6af0954d783","repo":"tonhowtf/omniget","slug":"nao-reconheci-um-video-do-youtube-em","errorCode":null,"errorMessage":"nao reconheci um video do YouTube em: {}","messagePattern":"nao reconheci um video do YouTube em: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/ryd.rs","lineNumber":27,"sourceCode":"pub struct Votes {\n    pub id: String,\n    #[serde(rename = \"dateCreated\", default)]\n    pub date_created: String,\n    #[serde(default)]\n    pub likes: u64,\n    #[serde(default)]\n    pub dislikes: u64,\n    #[serde(default)]\n    pub rating: f64,\n    #[serde(rename = \"viewCount\", default)]\n    pub view_count: u64,\n    #[serde(default)]\n    pub deleted: bool,\n}\n\npub async fn votes(input: &str) -> anyhow::Result<Votes> {\n    let id = super::sponsorblock::video_id(input)\n        .ok_or_else(|| anyhow!(\"nao reconheci um video do YouTube em: {}\", input))?;\n    let client = super::client()?;\n    let resp = client\n        .get(format!(\"{}/votes?videoId={}\", API, id))\n        .send()\n        .await?;\n    if !resp.status().is_success() {\n        return Err(anyhow!(\"Return YouTube Dislike: HTTP {}\", resp.status()));\n    }\n    Ok(resp.json().await?)\n}\n","sourceCodeStart":9,"sourceCodeEnd":38,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/ryd.rs#L9-L38","documentation":"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.","triggerScenarios":"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().","commonSituations":"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.","solutions":["Pass a canonical watch URL: https://www.youtube.com/watch?v=<11-char-id>","Or pass the bare 11-character video id directly","Strip surrounding text/trackers and confirm the id is exactly 11 base64-url characters","Check video_id()'s accepted patterns if using an uncommon YouTube URL form (e.g. live or embed)"],"exampleFix":"// before\nvotes(\"https://www.youtube.com/playlist?list=PL123\").await?; // not a video\n// after\nvotes(\"https://www.youtube.com/watch?v=dQw4w9WgXcQ\").await?;","handlingStrategy":"validation","validationCode":"const ID_RE: &str = r\"(?:youtube\\.com/(?:watch\\?v=|shorts/|embed/)|youtu\\.be/)?([A-Za-z0-9_-]{11})\";\nfn extract_video_id(u: &str) -> Option<&str> {\n    regex::Regex::new(ID_RE).ok()?.captures(u)?.get(1).map(|m| m.as_str())\n}\nif extract_video_id(input).is_none() { eprintln!(\"not a YouTube video: {}\", input); }","typeGuard":"fn is_youtube_video_url(u: &str) -> bool {\n    u.contains(\"youtube.com/watch\") || u.contains(\"youtu.be/\") || u.contains(\"youtube.com/shorts/\")\n}","tryCatchPattern":"match ryd::votes(input).await {\n    Ok(v) => handle(v),\n    Err(e) if e.to_string().contains(\"nao reconheci\") => {\n        eprintln!(\"{} is not a YouTube video id/URL\", input);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Normalize inputs to the canonical watch?v=<id> form before calling","Reject playlist/channel URLs early — they are not video ids","Verify the id is exactly 11 base64-url characters"],"tags":["youtube","video-id","url-parsing"],"backgroundTag":"invalid-identifier-format","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"}