tonhowtf/omniget · error
HTTP ao acessar pin
Error message
HTTP {} ao acessar pin {} What it means
fetch_pin_html fetches a Pinterest pin page and rejects any non-2xx status with this Portuguese-language error embedding the HTTP status and pin ID. It means Pinterest's server responded but with an error status (404, 403, 429, 5xx), so the HTML cannot be parsed for media.
Solutions
- Log response.status() and pin_id; handle 404 separately as 'Pin not found' with a user-friendly message.
- Add retry with exponential backoff for 429/5xx responses, honoring Retry-After headers.
- Rotate user-agent / use residential proxy if 403 persists (Pinterest bot detection).
- Validate the pin URL resolves to a real pin before fetching (use resolve_pin_url result).
Example fix
// before
if !response.status().is_success() {
return Err(anyhow!("HTTP {} ao acessar pin {}", response.status(), pin_id));
}
// after
let status = response.status();
if status == reqwest::StatusCode::NOT_FOUND {
anyhow::bail!("Pin not found: {}", pin_id);
}
if !status.is_success() {
anyhow::bail!("HTTP {} ao acessar pin {} (pode ser bloqueio ou pin removido)", status, pin_id);
} Defensive patterns
Strategy: retry
Validate before calling
// Rust: pre-validate the pin URL shape before fetching HTML
fn looks_like_pin_url(url: &str) -> bool {
url.contains("/pin/") || url.starts_with("https://pin.it/")
} Try / catch
match fetch_pin_html(&pin_id).await {
Err(e) if e.to_string().contains("HTTP 429") => {
tokio::time::sleep(Duration::from_secs(30)).await;
fetch_pin_html(&pin_id).await // retry once after backoff
}
Err(e) if e.to_string().contains("HTTP 404") => Err(anyhow!("Pin not found")),
other => other,
} Prevention
- Back off and honor Retry-After on 429s
- Rotate user-agent and route through residential proxies for scale scraping
- Distinguish 404 (pin gone) from 403/5xx (retryable) in error handling
- Add integration tests that assert behavior on each status class
When it happens
Trigger: native_get_media_info -> fetch_pin_html sends the GET request with browser-like headers and Pinterest returns a non-success status code for the pin page.
Common situations: Pin deleted or private (404/410); Pinterest blocking datacenter IPs or flagging the client (403); rate limiting (429); Pinterest outage (5xx); malformed pin URL that resolved to an error page.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/3adff70ffcbf4184.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/platforms/pinterest/mod.rs:109
let canonical = redirect::resolve_redirect(&self.client, url).await?;
return Ok(canonical);
}
Ok(url.to_string())
}
async fn fetch_pin_html(&self, pin_id: &str) -> anyhow::Result<String> {
let url = format!("https://www.pinterest.com/pin/{}/", pin_id);
let response = self
.client
.get(&url)
.header("Accept", "text/html")
.header("Accept-Language", "en-US,en;q=0.9")
.send()
.await?;
if !response.status().is_success() {
return Err(anyhow!(
"HTTP {} ao acessar pin {}",
response.status(),
pin_id
));
}
response.text().await.map_err(Into::into)
}
fn check_pin_not_found(html: &str) -> bool {
PIN_NOT_FOUND_RE.is_match(html)
}
fn extract_video_url(html: &str) -> Option<String> {
VIDEO_URL_RE
.captures_iter(html)
.filter_map(|cap| cap.get(1).map(|m| m.as_str().to_string()))
.find(|url| url.ends_with(".mp4"))View on GitHub (pinned to 8600b91f42)