tonhowtf/omniget · error · anyhow::Error
Could not extract user and post_id from URL
Error message
Could not extract user and post_id from URL
What it means
In `native_get_media_info` (src-tauri/src/platforms/bluesky/mod.rs:33), `Self::extract_user_and_post(url)` failed to pull a valid username and post id (rkey) out of the given Bluesky URL, so the function aborts before calling the AppView API. The URL was not in a recognized bsky.app post format.
Solutions
- Verify the URL matches the expected post format: https://bsky.app/profile/<handle>/post/<rkey>.
- Strip query strings and fragments before passing the URL.
- Resolve alternate-domain links to the canonical bsky.app form first.
- Improve `extract_user_and_post` to handle additional URL shapes (at:// URIs, staging domains).
Example fix
// before
let (user, post_id) = Self::extract_user_and_post(url)
.ok_or_else(|| anyhow!("Could not extract user and post_id from URL"))?;
// after
let url = url.split('?').next().unwrap_or(url);
let (user, post_id) = Self::extract_user_and_post(url)
.ok_or_else(|| anyhow!("Could not extract user and post_id from URL: {}", url))?; Defensive patterns
Strategy: validation
Validate before calling
fn looks_like_bsky_post(url: &str) -> bool {
let u = url.split('?').next().unwrap_or(url);
u.starts_with("https://bsky.app/profile/") && u.matches("/post/").count() == 1
} Prevention
- Validate the URL shape before calling get_media_info.
- Strip query strings and fragments from pasted links.
- Normalize alternative Bluesky domains to bsky.app first.
When it happens
Trigger: Passing a URL that is not a bsky.app profile post link (e.g. a profile root, a search page, a shortened/rebranded host, or a malformed link) to get_media_info, so the regex/parser finds no user/post_id pair.
Common situations: Users paste their profile URL instead of a post URL; links copied from the Bluesky web app include extra query params or use alternate domains; URLs with escaped or truncated post ids.
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
- não reconheci esse perfil ou coleção
- InvalidRequest
- isso é um vídeo, não um perfil
- cole o link de um VOD ou de um clipe da Twitch
- Could not extract user and post_id from URL
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/adc6482b1e5a0dba.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/platforms/bluesky/mod.rs:33
client: reqwest::Client,
}
impl Default for BlueskyDownloader {
fn default() -> Self {
Self::new()
}
}
impl BlueskyDownloader {
async fn fallback_ytdlp(&self, url: &str) -> anyhow::Result<MediaInfo> {
let ytdlp_path = crate::core::ytdlp::ensure_ytdlp().await?;
let json = crate::core::ytdlp::get_video_info(&ytdlp_path, url, &[]).await?;
crate::platforms::generic_ytdlp::GenericYtdlpDownloader::parse_video_info(&json)
}
async fn native_get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {
let (user, post_id) = Self::extract_user_and_post(url)
.ok_or_else(|| anyhow!("Could not extract user and post_id from URL"))?;
let json = self.fetch_post(&user, &post_id).await?;
let embed = json
.pointer("/thread/post/embed")
.ok_or_else(|| anyhow!("Post does not contain media"))?;
let media = extract_media(embed).ok_or_else(|| anyhow!("Unsupported media type"))?;
let filename_base = format!("bluesky_{}_{}", sanitize_filename::sanitize(&user), post_id);
match media {
BlueskyMedia::Video { hls_url } => Ok(MediaInfo {
title: filename_base,
author: user,
platform: "bluesky".to_string(),
duration_seconds: None,
thumbnail_url: None,View on GitHub (pinned to 8600b91f42)