{"record":{"id":"17c1a0bb9ce8f510","repo":"tonhowtf/omniget","slug":"could-not-extract-pin-id","errorCode":null,"errorMessage":"Could not extract pin ID","messagePattern":"Could not extract pin ID","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/platforms/pinterest.rs","lineNumber":271,"sourceCode":"            file_size_bytes: total_bytes,\n            duration_seconds: 0.0,\n            torrent_id: None,\n        })\n    }\n}\n\nimpl PinterestDownloader {\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 canonical = self.resolve_pin_url(url).await?;\n\n        let pin_id =\n            Self::extract_pin_id(&canonical).ok_or_else(|| anyhow!(\"Could not extract pin ID\"))?;\n\n        let html = self.fetch_pin_html(&pin_id).await?;\n\n        if Self::check_pin_not_found(&html) {\n            return Err(anyhow!(\"Pin not found\"));\n        }\n\n        if let Some(video_url) = Self::extract_video_url(&html) {\n            return Ok(MediaInfo {\n                title: format!(\"pinterest_{}\", pin_id),\n                author: String::new(),\n                platform: \"pinterest\".to_string(),\n                duration_seconds: None,\n                thumbnail_url: None,\n                available_qualities: vec![VideoQuality {\n                    label: \"original\".to_string(),\n                    width: 0,\n                    height: 0,","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/platforms/pinterest.rs#L253-L289","documentation":"native_get_media_info() canonicalizes the input URL then runs extract_pin_id() on it; if no pin ID can be parsed, this error is thrown. The pin ID is required for all subsequent HTML fetching and title/media extraction, so the operation cannot proceed without it.","triggerScenarios":"Passing a Pinterest URL that is not a pin page — e.g. a user/board/profile URL, a shortened pin.it link that didn't resolve, or a URL whose canonical form changed structure so extract_pin_id's pattern no longer matches.","commonSituations":"Users paste board or profile links instead of pin links; pin.it short links redirect to unexpected forms; Pinterest changes its URL scheme (/pin/<id>/ vs other formats); trailing query fragments confusing the regex.","solutions":["Verify the input is a pin URL of the form pinterest.com/pin/<id>","Ensure resolve_pin_url followed all redirects (including pin.it short links) before extraction","Update extract_pin_id's pattern to cover the current Pinterest URL formats","Surface a user-facing message asking for a direct pin link"],"exampleFix":"// before\nlet pin_id = Self::extract_pin_id(&canonical)\n    .ok_or_else(|| anyhow!(\"Could not extract pin ID\"))?;\n// after\nlet pin_id = Self::extract_pin_id(&canonical).ok_or_else(|| anyhow!(\n    \"Could not extract pin ID from '{}' — expected a pinterest.com/pin/<id> URL\",\n    canonical\n))?;","handlingStrategy":"validation","validationCode":"fn looks_like_pin_url(url: &str) -> bool {\n    let u = url.trim();\n    u.contains(\"pinterest.\") && u.contains(\"/pin/\") || u.starts_with(\"https://pin.it/\")\n}","typeGuard":null,"tryCatchPattern":"if !looks_like_pin_url(url) {\n    return Err(anyhow!(\"not a pin URL — expected pinterest.com/pin/<id>\"));\n}\nlet info = platform.get_media_info(url).await?;","preventionTips":["Validate URL shape before calling get_media_info","Ensure short pin.it links are fully resolved before extraction","Ask users to share direct pin links, not boards/profiles","Add unit tests for current Pinterest URL formats in extract_pin_id"],"tags":["pinterest","url","parsing","scraping","input-validation"],"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"}