tonhowtf/omniget · error

HTTP ao acessar pin

Error message

HTTP {} ao acessar pin {}

What it means

fetch_pin_html() fetches the Pinterest pin page and checks response.status().is_success(); any non-2xx status aborts with 'HTTP <status> ao acessar pin <id>'. It surfaces the HTTP-level failure of scraping the pin's HTML so callers know the pin page could not be retrieved.

Solutions

  1. Check the returned status: 404 means the pin is gone, stop retrying
  2. On 403, use more browser-like headers or route via a residential proxy
  3. On 429, back off and retry with exponential delay; throttle request rate
  4. On 5xx, retry after a short delay; verify status on status.pinterest.com
  5. Ensure the pin_id came from resolve_pin_url and is valid

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::TOO_MANY_REQUESTS {
    tokio::time::sleep(Duration::from_secs(30)).await;
    return self.fetch_pin_html(&pin_id).await; // bounded retry
}
if !status.is_success() {
    return Err(anyhow!("HTTP {} ao acessar pin {}", status, pin_id));
}
Defensive patterns

Strategy: retry

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;
        // bounded retry
    }
    Err(e) if e.to_string().contains("HTTP 404") => return Err(anyhow!("pin is gone")),
    other => other?,
}

Prevention

When it happens

Trigger: Pinterest returns 404 (pin deleted/nonexistent), 403 (blocked scraper/region), 429 (rate limited), or 5xx while fetching the pin page for the extracted pin_id.

Common situations: Pin was removed or set private; Pinterest blocks requests lacking valid cookies/headers or from datacenter IPs; scraping too aggressively triggers rate limits; temporary Pinterest outages.

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/be3901e24d9adf56. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/pinterest.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)