{"record":{"id":"880991e7479625ae","repo":"tonhowtf/omniget","slug":"could-not-extract-post-id","errorCode":null,"errorMessage":"Could not extract post ID","messagePattern":"Could not extract post ID","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/platforms/instagram.rs","lineNumber":683,"sourceCode":"                return host == \"instagram.com\"\n                    || host.ends_with(\".instagram.com\")\n                    || host == \"ddinstagram.com\"\n                    || host.ends_with(\".ddinstagram.com\");\n            }\n        }\n        false\n    }\n\n    async fn get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {\n        if Self::is_story_url(url) {\n            return Err(anyhow!(\n                \"Instagram Stories are not supported. Only public posts, reels and carousels.\"\n            ));\n        }\n\n        let post_id = if let Some(share_id) = Self::extract_share_id(url) {\n            let resolved = self.resolve_share_link(&share_id).await?;\n            Self::extract_post_id(&resolved).ok_or_else(|| anyhow!(\"Could not extract post ID\"))?\n        } else {\n            Self::extract_post_id(url).ok_or_else(|| anyhow!(\"Could not extract post ID\"))?\n        };\n\n        let filename_base = format!(\"instagram_{}\", post_id);\n\n        let embed_result = self.request_embed(&post_id).await;\n        let media = match embed_result {\n            Ok(data) => Self::extract_media_from_embed(&data),\n            Err(_embed_err) => match self.request_gql(&post_id).await {\n                Ok(data) => Self::extract_media_from_gql(&data),\n                Err(_gql_err) => {\n                    return self.fallback_ytdlp(url, &post_id).await;\n                }\n            },\n        };\n\n        let media = match media {","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/platforms/instagram.rs#L665-L701","documentation":"After resolving a share link (instagr.am/share/... style), get_media_info re-runs extract_post_id on the resolved URL. This error is thrown when the resolved URL still doesn't yield a post ID — i.e. the share-link resolution succeeded (or produced a URL) but the shortcode pattern /p/<id>/, /reel/<id>/, /tv/<id>/ etc. could not be matched.","triggerScenarios":"extract_share_id matched a share URL, resolve_share_link returned a page whose final URL does not contain a recognizable /p|/reel|/tv/<shortcode>/ segment, so extract_post_id(&resolved) returns None.","commonSituations":"Instagram share links redirecting to an intermediate/login page; new share-link formats that land on URLs the extractor regex doesn't cover; shortened links that resolve to a profile page rather than a post; region-redirect URLs.","solutions":["Log the resolved URL to see where share links actually land and extend extract_post_id's pattern list to cover it.","Check that resolve_share_link follows all redirects (reqwest redirect policy) and isn't stopping at a login/consent interstitial.","Ask users to paste the canonical /p/<id>/ or /reel/<id>/ URL directly instead of share links.","Handle redirect-to-profile gracefully with a clear 'not a post URL' message."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Rust: validate the resolved URL contains a post shortcode before proceeding\nfn extract_shortcode(url: &str) -> Option<&str> {\n    for marker in [\"/p/\", \"/reel/\", \"/reels/\", \"/tv/\"] {\n        if let Some(i) = url.find(marker) {\n            let rest = &url[i + marker.len()..];\n            let end = rest.find('/').unwrap_or(rest.len());\n            let id = &rest[..end];\n            if !id.is_empty() { return Some(id); }\n        }\n    }\n    None\n}","typeGuard":null,"tryCatchPattern":"match get_media_info(url).await {\n    Err(e) if e.to_string().contains(\"Could not extract post ID\") => {\n        // share link resolved to a non-post page (login/profile); ask user for canonical URL\n        ui.show_message(\"Please paste a direct /p/<id>/ or /reel/<id>/ link.\");\n    }\n    other => other?,\n}","preventionTips":["Ensure the HTTP client follows all redirects when resolving share links","Log the resolved URL to catch redirect-to-login flows","Ask users for canonical /p/<id>/ links instead of share links","Extend the shortcode pattern list whenever Instagram adds new path segments"],"tags":["instagram","url-parsing","share-links"],"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"}