tonhowtf/omniget · error
o Reddit barrou o acesso público (403). Costuma ser…
Error message
o Reddit barrou o acesso público (403). Costuma ser bloqueio de rede ou conteúdo restrito: tente de outra conexão
What it means
Reddit responds with HTTP 403 Forbidden when public, unauthenticated access is blocked. `get_json` maps that status directly to this message because it usually means network-level blocking or restricted content, not a bug in the caller. Unlike 404, retrying will not help — the access path itself is denied.
Solutions
- Switch network/connection (different IP, no VPN, or residential connection)
- Set a descriptive, browser-like User-Agent header on requests
- If content is restricted (private/quarantined sub), authenticate via OAuth instead of public endpoints
- Check whether a corporate firewall or DNS filter is blocking reddit.com
Example fix
// before
let client = reqwest::Client::new(); // default UA, often blocked
// after
let client = reqwest::Client::builder()
.user_agent("web:myapp:v1.0 (by /u/myuser)")
.build()?; Defensive patterns
Strategy: fallback
Validate before calling
// pre-flight reachability check from this network
let probe = client.get("https://www.reddit.com/r/popular.json")
.header("User-Agent", UA).send().await?;
if probe.status() == reqwest::StatusCode::FORBIDDEN {
eprintln!("This network/IP appears blocked by Reddit — switch connection");
} Try / catch
match client.get_json(url).await {
Ok(v) => v,
Err(e) if e.to_string().contains("barrou o acesso") => {
eprintln!("403: blocked — retrying via alternate endpoint/proxy or failing gracefully");
fetch_via_fallback(url).await.unwrap_or_default()
}
Err(e) => return Err(e.into()),
} Prevention
- Don't run bulk scraping from datacenter/VPN IP ranges Reddit blocks
- Set an honest, descriptive User-Agent (OAuth app convention: platform:app:version)
- Detect 403 once and stop the job instead of retrying the same blocked IP
- Offer OAuth-authenticated mode for restricted content
When it happens
Trigger: Any `get_json` call where Reddit returns 403: requests from cloud/datacenter IPs or known VPN ranges, requests without an accepted User-Agent, or content that requires login/age verification.
Common situations: Running on a cloud VM whose IP range Reddit blocks; corporate firewall or country-level blocking of reddit.com; accessing quarantined/NSFW/subscriber-only content while unauthenticated; missing or bot-like User-Agent header.
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
- Access denied (403). The video may be private or…
- acesso negado (HTTP ). Capture os cookies da sua conta no…
- criar perfil
- describe
- download de falhou: HTTP
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/a934c068da10c79f.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/reddit/mod.rs:449
}
Ok(r) if r.status().as_u16() == 429 || r.status().is_server_error() => {
if attempt == TRIES {
return Err(anyhow!(
"o Reddit está limitando o acesso (HTTP {}). Tente de novo daqui a pouco",
r.status()
));
}
let retry = r
.headers()
.get(reqwest::header::RETRY_AFTER)
.and_then(|v| v.to_str().ok())
.and_then(|v| v.trim().parse::<u64>().ok())
.map(Duration::from_secs);
tokio::time::sleep(retry.unwrap_or(wait)).await;
wait *= 2;
}
Ok(r) if r.status().as_u16() == 403 => {
return Err(anyhow!(
"o Reddit barrou o acesso público (403). Costuma ser bloqueio de rede ou conteúdo restrito: tente de outra conexão"
));
}
Ok(r) if r.status().as_u16() == 404 => {
return Err(anyhow!(
"post não encontrado (apagado, privado ou id errado)"
));
}
Ok(r) => {
return Err(anyhow!("HTTP {} em {}", r.status(), url));
}
Err(e) if attempt < TRIES => {
tokio::time::sleep(wait).await;
wait *= 2;
let _ = e;
}
Err(e) => return Err(e.into()),
}View on GitHub (pinned to 8600b91f42)