tonhowtf/omniget · error
Instagram redirecionou para login — post pode ser privado
Error message
Instagram redirecionou para login — post pode ser privado
What it means
get_gql_params fetches the post's HTML page to extract GraphQL query parameters. When the returned HTML is detected as a login redirect (is_login_redirect), Instagram is not serving the public post page — most often because the post requires authentication — so the library fails with this Portuguese message meaning 'Instagram redirected to login — post may be private'.
Solutions
- Confirm the post is publicly viewable in an incognito browser.
- Supply authenticated cookies (sessionid etc.) in the request if the post is behind a private account.
- Use a residential IP or reduce request rate — datacenter IPs commonly get login-walled.
- Handle the error in the caller by reporting 'post requires authentication' to the user instead of retrying.
Example fix
// before
match platform.get_media_info(&url).await {
Err(e) if e.to_string().contains("login") => { /* crash or generic retry */ }
r => r?,
}
// after
match platform.get_media_info(&url).await {
Err(e) if e.to_string().contains("login") => {
println!("This post appears private; provide cookies or open it publicly.");
return Ok(None);
}
r => r.map(Some)?,
} Defensive patterns
Strategy: try-catch
Validate before calling
// Preflight: does the post render publicly without login? // GET https://www.instagram.com/p/<shortcode>/ and confirm HTML lacks a login form / contains og:title with the caption.
Try / catch
match platform.get_media_info(url).await {
Err(e) if e.to_string().contains("login") => {
// do NOT retry blindly; surface auth requirement
Err(anyhow!("post requires authentication: provide session cookies or use a public post"))
}
other => other,
} Prevention
- Verify the post opens in an incognito browser before scraping.
- Provide authenticated cookies for private accounts.
- Avoid datacenter IPs; use residential egress and throttle request rate.
- Detect login walls early (check for 'loginForm' in HTML) instead of parsing failures.
When it happens
Trigger: request_gql → get_gql_params fetches the post URL and is_login_redirect(&html) returns true: private account, login-walled post, logged-out access blocked, or Instagram serving an auth challenge to the client's IP/session.
Common situations: Scraping private or followers-only posts without cookies; datacenter IPs that Instagram forces into login walls; Instagram A/B tests pushing anonymous users to login; deleted posts that redirect to login.
Related errors
- não achei o secUid de @
- nenhum favorito foi lido: esses perfis costumam exigir a…
- nenhum like foi lido: os likes só aparecem com a sessão do…
- o X serviu a versao deslogada da pagina
- Server returned HTML instead of media — the link may have…
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/9bd525f6371b6f0b.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/platforms/instagram.rs:193
let response = self
.client
.get(&url)
.header(
"Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
)
.header("Accept-Language", "en-GB,en;q=0.9")
.header("Sec-Fetch-Dest", "document")
.header("Sec-Fetch-Mode", "navigate")
.header("Sec-Fetch-Site", "none")
.header("Sec-Fetch-User", "?1")
.send()
.await?;
let html = response.text().await?;
if Self::is_login_redirect(&html) {
return Err(anyhow!(
"Instagram redirecionou para login — post pode ser privado"
));
}
let csrf = Self::extract_object_entry("InstagramSecurityConfig", &html)
.and_then(|v| {
v.get("csrf_token")
.and_then(|t| t.as_str())
.map(|s| s.to_string())
})
.unwrap_or_default();
let polaris = Self::extract_object_entry("PolarisSiteData", &html);
let device_id = polaris
.as_ref()
.and_then(|v| {
v.get("device_id")
.and_then(|t| t.as_str())View on GitHub (pinned to 8600b91f42)