tonhowtf/omniget · error

No media found in embed

Error message

No media found in embed

What it means

extract_media_from_embed parses the JSON scraped from an embed page looking for gql_data.shortcode_media/xdt_shortcode_media, a direct video_url, or media.display_url/display_url. This error is thrown when the embed JSON was extracted successfully but contains none of those fields — no media URL could be located in the payload.

Solutions

  1. Log the extracted embed JSON on failure to see the actual shape and update the key paths accordingly.
  2. Verify the post is public and embeddable; for private/deleted posts surface a clear 'post unavailable' error instead.
  3. Rely on fallback_ytdlp (yt-dlp) for posts the embed parser cannot extract.
  4. Keep the embed-extraction regexes and key paths in sync with Instagram's current embed page format.
Defensive patterns

Strategy: fallback

Validate before calling

// Rust: check embed JSON has any known media path before extraction
fn embed_has_media(data: &serde_json::Value) -> bool {
    data.get("gql_data").is_some()
        || data.get("video_url").is_some()
        || data.get("display_url").is_some()
        || data.get("media").and_then(|m| m.get("display_url")).is_some()
}

Try / catch

match extract_media_from_embed(&embed_json) {
    Ok(media) => media,
    Err(e) if e.to_string().contains("No media found in embed") => {
        // embed payload has no media (private/deleted post or format change); use yt-dlp
        fallback_ytdlp(url, &post_id).await
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: request_embed returned JSON (e.g. the contextJSON blob or __additionalDataLoaded payload) whose structure lacks gql_data, video_url, media.display_url and display_url — typically an empty/degraded embed payload for a private, deleted, or non-embeddable post.

Common situations: Instagram changed the embed contextJSON layout; post belongs to a private/deleted account so the embed renders without media; embed payload only contains caption/context data and the media fields were stripped.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/instagram.rs:646

            return Ok(InstagramMedia::Single {
                url: video_url.to_string(),
                is_video: true,
            });
        }

        if let Some(display_url) = data
            .get("media")
            .and_then(|m| m.get("display_url"))
            .or_else(|| data.get("display_url"))
            .and_then(|v| v.as_str())
        {
            return Ok(InstagramMedia::Single {
                url: display_url.to_string(),
                is_video: false,
            });
        }

        Err(anyhow!("No media found in embed"))
    }
}

fn base64_url_encode(bytes: &[u8]) -> String {
    use base64::Engine;
    base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(bytes)
}

#[async_trait]
impl PlatformDownloader for InstagramDownloader {
    fn name(&self) -> &str {
        "instagram"
    }

    fn can_handle(&self, url: &str) -> bool {
        if let Ok(parsed) = url::Url::parse(url) {
            if let Some(host) = parsed.host_str() {
                let host = host.to_lowercase();

View on GitHub (pinned to 8600b91f42)