tonhowtf/omniget · error
o pin.it nao redirecionou
Error message
o pin.it nao redirecionou
What it means
resolve_short() issues a GET to a pin.it short link and reads the Location response header to follow the redirect manually. If the response carries no Location header at all, the library raises "o pin.it nao redirecionou". Pinterest short links are expected to 3xx-redirect to a canonical /pin/<id>/ URL; a non-redirect response means the link is dead or Pinterest answered with an error/interstitial page.
Solutions
- Validate the pin.it URL resolves in a normal browser before feeding it to the library.
- Regenerate a fresh pin.it link or ask the user for the full pinterest.com/pin/<id>/ URL.
- Inspect the HTTP status of the response (log it) — a 404/410 means the short link is gone.
- Retry with backoff in case of a transient interstitial response.
Example fix
// before
let target = api.resolve_short(code).await?;
// after
let target = api.resolve_short(code).await
.map_err(|e| { log::warn!("pin.it/{code} did not redirect: {e}"); MyError::BadShareLink(code.clone()) })?; Defensive patterns
Strategy: fallback
Validate before calling
// Check the short-link shape up front
fn is_pinit_url(u: &str) -> bool { u.starts_with("https://pin.it/") && u.len() > "https://pin.it/".len() } Type guard
null
Try / catch
let url = match api.resolve_short(code).await {
Ok(u) => u,
Err(_) => return Err(anyhow!("pin.it/{code} is dead; ask for the full pin URL")),
}; Prevention
- Prefer full pinterest.com/pin/<id>/ URLs over pin.it links
- Test short links in a browser before automation
- Log HTTP status when resolution fails to spot 404/410
- Ask users to re-share links that expired
When it happens
Trigger: Calling resolve_short (directly or via feed_for with Target::Short) when the pin.it code is expired/invalid, or Pinterest replies 200 (block page) / 4xx / 5xx without a Location header.
Common situations: Old pin.it links shared in chats that were later deleted; headless clients whose requests Pinterest answers with an anti-bot 200 page; proxy stripping redirect headers.
Related errors
- nao entendi o destino de pin.it/{}
- Nenhum redirect encontrado para {}
- Pinterest respondeu HTTP {} sem JSON ({})
- Pinterest: {} (HTTP {})
- nao consegui baixar a imagem ({})
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/2429be4bee1feff2.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/pinterest/api.rs:1217
{
if !out.contains(&t) {
out.push(t);
}
}
}
Ok(out)
}
/// Expande `pin.it/xxxx` para a URL final.
pub async fn resolve_short(&self, code: &str) -> anyhow::Result<String> {
let url = format!("https://api.pinterest.com/url_shortener/{}/redirect/", code);
let resp = self.http.get(&url).send().await?;
let mut loc = resp
.headers()
.get(reqwest::header::LOCATION)
.and_then(|v| v.to_str().ok())
.map(|v| v.to_string())
.ok_or_else(|| anyhow!("o pin.it nao redirecionou"))?;
// às vezes há um segundo pulo (pinterest.com/pin/…/sent/?…)
for _ in 0..3 {
if parse_target(&loc)
.map(|t| !matches!(t, Target::Short { .. }))
.unwrap_or(false)
&& !loc.ends_with("pinterest.com/")
{
break;
}
let r = self.http.get(&loc).send().await?;
match r
.headers()
.get(reqwest::header::LOCATION)
.and_then(|v| v.to_str().ok())
{
Some(l) => loc = l.to_string(),
None => break,
}View on GitHub (pinned to 8600b91f42)