tonhowtf/omniget · error
cole o link de um post do Reddit, de um i.redd.it ou de um…
Error message
cole o link de um post do Reddit, de um i.redd.it ou de um v.redd.it
What it means
parse_target() failed to classify the supplied URL as a Reddit post, media (i.redd.it / v.redd.it), external link, subreddit, user, or short link. The library throws this anyhow error to tell the user the input is not a recognizable Reddit download target. It is the first validation step of run(), so nothing has been fetched yet.
Solutions
- Check opts.url is a full https:// Reddit post URL (reddit.com/r/<sub>/comments/<id>/...) or an i.redd.it / v.redd.it media link
- Strip tracking/query parameters and re-submit the canonical post URL
- If you have a short link (redd.it/<id>), pass it — it is resolved via Target::Short — but ensure it actually points to a post
- Verify the URL includes the scheme (https://); add it if missing
Example fix
// before
run(RunOpts { url: "my-favorite-post".into(), .. })
// after
run(RunOpts { url: "https://www.reddit.com/r/rust/comments/abc123/title/".into(), .. }) Defensive patterns
Strategy: validation
Validate before calling
fn is_reddit_post_or_media(url: &str) -> bool {
let u = url.trim();
u.starts_with("https://")
&& (u.contains("reddit.com/r/") && u.contains("/comments/")
|| u.contains("i.redd.it/")
|| u.contains("v.redd.it/"))
}
// call before run(): assert!(is_reddit_post_or_media(&opts.url)); Type guard
fn looks_like_reddit_url(s: &str) -> bool {
s.starts_with("https://") && s.contains("reddit.com") || s.contains("redd.it/")
} Prevention
- Always paste the full canonical post URL including https:// and /comments/<id>/
- Strip share/tracking query parameters before passing URLs
- Prefer i.redd.it / v.redd.it links for direct media
- Test parse_target logic in unit tests with your expected URL shapes
When it happens
Trigger: run()/baixa_um_video_de_verdade/baixa_uma_galeria_de_verdade called with opts.url that is empty, not a URL, a reddit.com/comments listing without an id, an old.reddit.com variant parse_target doesn't recognize, or a non-Reddit URL.
Common situations: Pasting only a post title or id instead of the full link; copying a link from a share sheet that yields a tracking URL; feeding a search-results or crosspost page; typos like 'redd.it' without scheme handled differently by parse_target.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- isto é um sub ou um perfil: cole o link de um post
- escolha o zip do export do Reddit ou a pasta onde ele foi…
- o link curto não levou a um post
- isto não é um post: cole o link de uma thread (com…
- cole o link de um VOD ou de um clipe da Twitch
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/fec6b34946560751.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/reddit/download.rs:539
async fn download_gallery_dl(
url: &str,
dest: &Path,
progress: &ProgressFn,
) -> Result<(Vec<String>, String)> {
let r =
crate::core::tools::gallery::download(url, &dest.to_string_lossy(), None, progress.clone())
.await?;
Ok((r.files, r.log_tail))
}
pub async fn run(opts: &Options, progress: ProgressFn) -> Result<DownloadResult> {
report(&progress, ID, "started", 0, None, None);
let dest = PathBuf::from(&opts.dest);
std::fs::create_dir_all(&dest)?;
let fetcher = Fetcher::new(opts.delay_ms, opts.session_netscape.as_deref())?;
let mut target = parse_target(&opts.url).ok_or_else(|| {
anyhow!("cole o link de um post do Reddit, de um i.redd.it ou de um v.redd.it")
})?;
if let Target::Short { url } = &target {
let final_url = fetcher.resolve(url).await?;
target = parse_target(&final_url)
.ok_or_else(|| anyhow!("o link curto não levou a um post ({})", final_url))?;
}
// Mídia solta e link de fora não têm post para consultar.
let (post, plan) = match &target {
Target::Post { id, .. } => {
let post = fetch_post(&fetcher, id).await?;
let plan = plan_for(&post);
(Some(post), plan)
}
Target::Media { url, video: true } => (None, Plan::Video { url: url.clone() }),
Target::Media { url, video: false } => (None, Plan::Image { url: url.clone() }),
Target::External { url } => (None, Plan::External { url: url.clone() }),
Target::Subreddit { .. } | Target::User { .. } => {View on GitHub (pinned to 8600b91f42)