{"record":{"id":"d057c124037d2261","repo":"tonhowtf/omniget","slug":"could-not-extract-clip-slug-mod","errorCode":null,"errorMessage":"Could not extract clip slug","messagePattern":"Could not extract clip slug","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/twitch/mod.rs","lineNumber":51,"sourceCode":"    client: reqwest::Client,\n}\n\nimpl Default for TwitchClipsDownloader {\n    fn default() -> Self {\n        Self::new()\n    }\n}\n\nimpl TwitchClipsDownloader {\n    async fn fallback_ytdlp(&self, url: &str) -> anyhow::Result<MediaInfo> {\n        let ytdlp_path = crate::core::ytdlp::ensure_ytdlp().await?;\n        let json = crate::core::ytdlp::get_video_info(&ytdlp_path, url, &[]).await?;\n        crate::platforms::generic_ytdlp::GenericYtdlpDownloader::parse_video_info(&json)\n    }\n\n    async fn native_get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {\n        let slug =\n            Self::extract_clip_slug(url).ok_or_else(|| anyhow!(\"Could not extract clip slug\"))?;\n\n        let clip = self.fetch_clip_metadata(&slug).await?;\n\n        if clip.video_qualities.is_empty() {\n            return Err(anyhow!(\"No video quality available\"));\n        }\n\n        let broadcaster = clip\n            .broadcaster_login\n            .as_deref()\n            .ok_or_else(|| anyhow!(\"Dados do clip incompletos\"))?;\n\n        let token = self.fetch_access_token(&slug).await?;\n\n        let clip_title = clip.title.trim().to_string();\n\n        let available_qualities: Vec<VideoQuality> = clip\n            .video_qualities","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/twitch/mod.rs#L33-L69","documentation":"native_get_media_info for Twitch derives the clip identity from the URL via extract_clip_slug(), which parses the slug out of a clips.twitch.com/.../Slug or twitch.tv/clip/Slug style URL. This error is thrown when the URL does not match any recognized clip URL pattern, so no slug can be obtained to query the Twitch GQL clip metadata API.","triggerScenarios":"Calling get_media_info on a Twitch URL that is not a clip URL (a VOD, channel, or homepage URL), or a malformed clip URL (missing slug, extra segments, mobile subdomain variant not covered by the regex).","commonSituations":"Users pasting a VOD link (videos.twitch.tv) expecting clip download; clip links with trailing query strings or locale prefixes; new Twitch clip URL formats not matching the extractor.","solutions":["Confirm the URL is a clip link of the form clips.twitch.tv/<channel>/<slug> or twitch.tv/<channel>/clip/<slug>.","Strip query parameters and trailing slashes before passing the URL.","Update extract_clip_slug to handle additional Twitch URL formats if a new shape appears.","Let the request fall through to the generic yt-dlp path, which handles more Twitch URL types."],"exampleFix":"// before\nlet slug = Self::extract_clip_slug(url)\n    .ok_or_else(|| anyhow!(\"Could not extract clip slug\"))?;\n// after\nlet slug = Self::extract_clip_slug(url).ok_or_else(|| anyhow!(\n    \"Could not extract clip slug from '{}' — expected a clips.twitch.tv/<channel>/<slug> URL\",\n    url\n))?;","handlingStrategy":"validation","validationCode":"// Validate the URL shape before calling get_media_info\nlet is_clip = url.contains(\"clips.twitch.tv\") || url.contains(\"/clip/\");\nif !is_clip { eprintln!(\"not a Twitch clip URL\"); }","typeGuard":"fn looks_like_clip_url(url: &str) -> bool {\n    url.contains(\"clips.twitch.tv/\") || url.contains(\"/clip/\")\n}","tryCatchPattern":"match get_media_info(url).await {\n    Err(e) if e.to_string().contains(\"clip slug\") => try_generic_ytdlp(url).await,\n    other => other,\n}","preventionTips":["Strip query strings and trailing slashes from Twitch URLs before processing.","Only pass clips.twitch.tv or twitch.tv/<channel>/clip/<slug> URLs to the native path.","Route VOD and channel URLs to their dedicated handlers."],"tags":["twitch","url-parsing","clip","invalid-url"],"backgroundTag":"invalid-url-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"}