{"record":{"id":"eb70a0b08fd2519b","repo":"tonhowtf/omniget","slug":"no-media-found-in-embed","errorCode":null,"errorMessage":"No media found in embed","messagePattern":"No media found in embed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/platforms/instagram.rs","lineNumber":646,"sourceCode":"            return Ok(InstagramMedia::Single {\n                url: video_url.to_string(),\n                is_video: true,\n            });\n        }\n\n        if let Some(display_url) = data\n            .get(\"media\")\n            .and_then(|m| m.get(\"display_url\"))\n            .or_else(|| data.get(\"display_url\"))\n            .and_then(|v| v.as_str())\n        {\n            return Ok(InstagramMedia::Single {\n                url: display_url.to_string(),\n                is_video: false,\n            });\n        }\n\n        Err(anyhow!(\"No media found in embed\"))\n    }\n}\n\nfn base64_url_encode(bytes: &[u8]) -> String {\n    use base64::Engine;\n    base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(bytes)\n}\n\n#[async_trait]\nimpl PlatformDownloader for InstagramDownloader {\n    fn name(&self) -> &str {\n        \"instagram\"\n    }\n\n    fn can_handle(&self, url: &str) -> bool {\n        if let Ok(parsed) = url::Url::parse(url) {\n            if let Some(host) = parsed.host_str() {\n                let host = host.to_lowercase();","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/platforms/instagram.rs#L628-L664","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Log the extracted embed JSON on failure to see the actual shape and update the key paths accordingly.","Verify the post is public and embeddable; for private/deleted posts surface a clear 'post unavailable' error instead.","Rely on fallback_ytdlp (yt-dlp) for posts the embed parser cannot extract.","Keep the embed-extraction regexes and key paths in sync with Instagram's current embed page format."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Rust: check embed JSON has any known media path before extraction\nfn embed_has_media(data: &serde_json::Value) -> bool {\n    data.get(\"gql_data\").is_some()\n        || data.get(\"video_url\").is_some()\n        || data.get(\"display_url\").is_some()\n        || data.get(\"media\").and_then(|m| m.get(\"display_url\")).is_some()\n}","typeGuard":null,"tryCatchPattern":"match extract_media_from_embed(&embed_json) {\n    Ok(media) => media,\n    Err(e) if e.to_string().contains(\"No media found in embed\") => {\n        // embed payload has no media (private/deleted post or format change); use yt-dlp\n        fallback_ytdlp(url, &post_id).await\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Verify post is public and embeddable before relying on embed extraction","Log the extracted embed JSON on failure to track Instagram format changes","Prefer GQL extraction first; use embed only as a secondary source","Keep yt-dlp as the terminal fallback"],"tags":["instagram","json-parsing","embed","scraping"],"backgroundTag":"unexpected-response-shape","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}