tonhowtf/omniget · error

TikTok retornou HTTP

Error message

TikTok retornou HTTP {}

What it means

fetch_detail in tiktok.rs sends the detail request and, unless the status is a success code or 302 (deliberately allowed), converts it into this error containing the HTTP status. It surfaces non-2xx/302 responses from TikTok's detail endpoint as a library error, so the caller knows the request itself failed before HTML parsing.

Solutions

  1. Read the embedded status: 404 means the video no longer exists; 403/429 mean throttling or bot detection
  2. Add retry with backoff for 429/5xx responses
  3. Rotate User-Agent/cookies or use a proxy if 403 persists
  4. Check the URL points to an existing, public TikTok video

Example fix

// before
return Err(anyhow!("TikTok retornou HTTP {}", status));
// after
return Err(match status.as_u16() {
    404 => anyhow!("TikTok video not found (HTTP 404)"),
    429 => anyhow!("TikTok rate limited (HTTP 429); retry later"),
    _ => anyhow!("TikTok retornou HTTP {}", status),
});
Defensive patterns

Strategy: retry

Validate before calling

if (!(await tiktokVideoExists(url))) throw new Error("TikTok video unavailable or deleted");

Try / catch

match tiktok.get_media_info(url).await {
    Err(e) if e.to_string().contains("TikTok retornou HTTP") => {
        let status = extract_status(&e);
        match status {
            404 => inform_user("Video deleted or private"),
            429 | 500..=599 => schedule_retry_with_backoff(),
            403 => switch_proxy_or_cookies(),
            _ => log_and_fail(e),
        }
    }
    other => other?,
}

Prevention

When it happens

Trigger: get_media_info -> fetch_detail where TikTok responds 403 (bot detection), 404 (video deleted/private), 429 (rate limited), or 5xx. Only 2xx and 302 pass through.

Common situations: Shared/deleted TikTok videos (404); aggressive rate limiting from repeated scraping (429); TikTok WAF blocking datacenter IPs (403); transient TikTok server errors (5xx).

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

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/tiktok.rs:144

        }
        if !url.starts_with("http://") && !url.starts_with("https://") {
            return false;
        }
        if url.contains("verify") || url.contains("captcha") {
            return false;
        }
        true
    }

    async fn fetch_detail(&self, post_id: &str) -> anyhow::Result<serde_json::Value> {
        let url = format!("https://www.tiktok.com/@i/video/{}", post_id);

        let response = self.client.get(&url).send().await?;

        let status = response.status();

        if !status.is_success() && status.as_u16() != 302 {
            return Err(anyhow!("TikTok retornou HTTP {}", status));
        }

        let mut cookie_parts = Vec::new();
        for cookie in response.cookies() {
            cookie_parts.push(format!("{}={}", cookie.name(), cookie.value()));
        }
        if !cookie_parts.is_empty() {
            let cookie_str = cookie_parts.join("; ");
            *self.captured_cookies.lock().await = Some(cookie_str);
        }

        let html = response.text().await?;

        if Self::is_captcha_page(&html) {
            return Err(anyhow!(
                "TikTok is blocking requests. Try again in a few minutes."
            ));
        }

View on GitHub (pinned to 8600b91f42)