tonhowtf/omniget · error
Could not extract post ID
Error message
Could not extract post ID
What it means
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.
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.
Defensive patterns
Strategy: validation
Validate before calling
// Rust: validate the resolved URL contains a post shortcode before proceeding
fn extract_shortcode(url: &str) -> Option<&str> {
for marker in ["/p/", "/reel/", "/reels/", "/tv/"] {
if let Some(i) = url.find(marker) {
let rest = &url[i + marker.len()..];
let end = rest.find('/').unwrap_or(rest.len());
let id = &rest[..end];
if !id.is_empty() { return Some(id); }
}
}
None
} Try / catch
match get_media_info(url).await {
Err(e) if e.to_string().contains("Could not extract post ID") => {
// share link resolved to a non-post page (login/profile); ask user for canonical URL
ui.show_message("Please paste a direct /p/<id>/ or /reel/<id>/ link.");
}
other => other?,
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- Could not extract post ID
- download falhou: HTTP
- nao achei os arquivos JSON de seguidores no export. No…
- e.to_string()
- escolha pelo menos um arquivo
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/880991e7479625ae.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/platforms/instagram.rs:683
return host == "instagram.com"
|| host.ends_with(".instagram.com")
|| host == "ddinstagram.com"
|| host.ends_with(".ddinstagram.com");
}
}
false
}
async fn get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {
if Self::is_story_url(url) {
return Err(anyhow!(
"Instagram Stories are not supported. Only public posts, reels and carousels."
));
}
let post_id = if let Some(share_id) = Self::extract_share_id(url) {
let resolved = self.resolve_share_link(&share_id).await?;
Self::extract_post_id(&resolved).ok_or_else(|| anyhow!("Could not extract post ID"))?
} else {
Self::extract_post_id(url).ok_or_else(|| anyhow!("Could not extract post ID"))?
};
let filename_base = format!("instagram_{}", post_id);
let embed_result = self.request_embed(&post_id).await;
let media = match embed_result {
Ok(data) => Self::extract_media_from_embed(&data),
Err(_embed_err) => match self.request_gql(&post_id).await {
Ok(data) => Self::extract_media_from_gql(&data),
Err(_gql_err) => {
return self.fallback_ytdlp(url, &post_id).await;
}
},
};
let media = match media {View on GitHub (pinned to 8600b91f42)