{"record":{"id":"e7ab5853b6ac3cfb","repo":"tonhowtf/omniget","slug":"nao-reconheci-um-video-do-youtube-em-sponsorblock","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/sponsorblock.rs","lineNumber":68,"sourceCode":"/// Aceita URL completa, `youtu.be/ID`, `shorts/ID` ou o próprio ID.\npub fn video_id(input: &str) -> Option<String> {\n    let s = input.trim();\n    if s.len() == 11\n        && s.chars()\n            .all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')\n    {\n        return Some(s.to_string());\n    }\n    let re =\n        regex::Regex::new(r\"(?:v=|youtu\\.be/|shorts/|embed/|live/)([A-Za-z0-9_-]{11})\").ok()?;\n    re.captures(s)\n        .and_then(|c| c.get(1))\n        .map(|m| m.as_str().to_string())\n}\n\npub async fn segments(input: &str, categories: &[String]) -> anyhow::Result<SponsorResult> {\n    let id = video_id(input)\n        .ok_or_else(|| anyhow!(\"nao reconheci um video do YouTube em: {}\", input))?;\n    let cats: Vec<&str> = if categories.is_empty() {\n        CATEGORIES.to_vec()\n    } else {\n        categories.iter().map(|s| s.as_str()).collect()\n    };\n    let mut h = Sha256::new();\n    h.update(id.as_bytes());\n    let prefix = &hex::encode(h.finalize())[..4];\n    let url = format!(\n        \"{}/api/skipSegments/{}?categories={}&actionTypes={}\",\n        SERVER,\n        prefix,\n        urlencoding::encode(&serde_json::to_string(&cats)?),\n        urlencoding::encode(r#\"[\"skip\",\"mute\",\"full\",\"poi\",\"chapter\"]\"#)\n    );\n    let client = super::client()?;\n    let resp = client.get(&url).send().await?;\n    let mut segs: Vec<Segment> = Vec::new();","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/sponsorblock.rs#L50-L86","documentation":"Thrown by `sponsorblock::segments` when `video_id(input)` fails to extract a YouTube video ID from the user-supplied input. The function accepts a URL or raw ID, and this error reports any input it cannot parse into an 11-character video ID.","triggerScenarios":"Calling `segments(input, categories)` with a non-YouTube URL, a youtu.be link with extra/missing path parts, a URL-encoded or embed URL variant the regex does not match, or a typo'd/empty string.","commonSituations":"Pasting a YouTube channel or playlist link instead of a video; mobile m.youtube.com share links with unusual query strings; passing an already-trimmed ID with whitespace or surrounding quotes; Vimeo/other platform links.","solutions":["Pass a standard watch URL (https://www.youtube.com/watch?v=VIDEO_ID), a youtu.be/VIDEO_ID link, or the bare 11-character video ID.","Strip whitespace and quotes from the input before calling.","Extract the `v` parameter yourself and pass only the ID.","If a new URL shape (e.g. live or shorts links) must be supported, extend the `video_id` regex."],"exampleFix":"// before\nsegments(\"https://youtube.com/playlist?list=PL123\", &cats).await?;\n// after\nsegments(\"https://www.youtube.com/watch?v=dQw4w9WgXcQ\", &cats).await?;","handlingStrategy":"validation","validationCode":"fn looks_like_video_id(s: &str) -> bool {\n    let s = s.trim();\n    s.len() == 11 && s.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')\n}","typeGuard":"fn is_youtube_id(s: &str) -> Option<&str> {\n    let s = s.trim();\n    (s.len() == 11 && !s.contains('/')).then_some(s)\n}","tryCatchPattern":null,"preventionTips":["Pass canonical watch URLs or bare 11-char IDs.","Trim whitespace/quotes from pasted input.","Don't pass playlist or channel links."],"tags":["validation","youtube","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"}