tonhowtf/omniget · error

Could not extract pin ID

Error message

Could not extract pin ID

What it means

native_get_media_info() canonicalizes the input URL then runs extract_pin_id() on it; if no pin ID can be parsed, this error is thrown. The pin ID is required for all subsequent HTML fetching and title/media extraction, so the operation cannot proceed without it.

Solutions

  1. Verify the input is a pin URL of the form pinterest.com/pin/<id>
  2. Ensure resolve_pin_url followed all redirects (including pin.it short links) before extraction
  3. Update extract_pin_id's pattern to cover the current Pinterest URL formats
  4. Surface a user-facing message asking for a direct pin link

Example fix

// before
let pin_id = Self::extract_pin_id(&canonical)
    .ok_or_else(|| anyhow!("Could not extract pin ID"))?;
// after
let pin_id = Self::extract_pin_id(&canonical).ok_or_else(|| anyhow!(
    "Could not extract pin ID from '{}' — expected a pinterest.com/pin/<id> URL",
    canonical
))?;
Defensive patterns

Strategy: validation

Validate before calling

fn looks_like_pin_url(url: &str) -> bool {
    let u = url.trim();
    u.contains("pinterest.") && u.contains("/pin/") || u.starts_with("https://pin.it/")
}

Try / catch

if !looks_like_pin_url(url) {
    return Err(anyhow!("not a pin URL — expected pinterest.com/pin/<id>"));
}
let info = platform.get_media_info(url).await?;

Prevention

When it happens

Trigger: Passing a Pinterest URL that is not a pin page — e.g. a user/board/profile URL, a shortened pin.it link that didn't resolve, or a URL whose canonical form changed structure so extract_pin_id's pattern no longer matches.

Common situations: Users paste board or profile links instead of pin links; pin.it short links redirect to unexpected forms; Pinterest changes its URL scheme (/pin/<id>/ vs other formats); trailing query fragments confusing the regex.

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


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/17c1a0bb9ce8f510. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/pinterest.rs:271

            file_size_bytes: total_bytes,
            duration_seconds: 0.0,
            torrent_id: None,
        })
    }
}

impl PinterestDownloader {
    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 canonical = self.resolve_pin_url(url).await?;

        let pin_id =
            Self::extract_pin_id(&canonical).ok_or_else(|| anyhow!("Could not extract pin ID"))?;

        let html = self.fetch_pin_html(&pin_id).await?;

        if Self::check_pin_not_found(&html) {
            return Err(anyhow!("Pin not found"));
        }

        if let Some(video_url) = Self::extract_video_url(&html) {
            return Ok(MediaInfo {
                title: format!("pinterest_{}", pin_id),
                author: String::new(),
                platform: "pinterest".to_string(),
                duration_seconds: None,
                thumbnail_url: None,
                available_qualities: vec![VideoQuality {
                    label: "original".to_string(),
                    width: 0,
                    height: 0,

View on GitHub (pinned to 8600b91f42)