{"record":{"id":"120956f68e138dd8","repo":"tonhowtf/omniget","slug":"no-media-found-in-embed-mod","errorCode":null,"errorMessage":"No media found in embed","messagePattern":"No media found in embed","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/instagram/mod.rs","lineNumber":638,"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":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/instagram/mod.rs#L620-L656","documentation":"Raised by `extract_media_from_embed` when the fetched embed HTML yields no `video_url` and no `display_url` — i.e. the parsed embed data contains no image or video the extractor recognizes. Like its GraphQL sibling (1111), it is the 'no downloadable media' sentinel for the embed path.","triggerScenarios":"Calling `extract_media_from_embed` on embed-page data where neither a video URL nor a display image URL was found: removed/private posts, new Instagram embed markup, or embed pages served as a login/consent wall.","commonSituations":"Instagram renames `display_url`/`video_url` in embed output; the embed endpoint returns an error page instead of media; the post is a story or unsupported type embedded in the page; rate limiting returns a stub page.","solutions":["Open the embed URL manually (https://www.instagram.com/p/<id>/embed/) to check whether media actually renders","Use `fallback_ytdlp` (yt-dlp) which tracks Instagram markup upstream and is more resilient to markup changes","Update the embed selectors/field names in `extract_media_from_embed` to the current Instagram markup","Retry with browser-like headers (`instagram_headers`) or a residential IP if the wall/limit page is the cause"],"exampleFix":"// before\nlet media = self.extract_media_from_embed(&html)?;\n// after\nmatch self.extract_media_from_embed(&html) {\n    Ok(m) => Ok(m),\n    Err(e) => {\n        tracing::warn!(\"embed media missing: {e:#}; delegating to yt-dlp\");\n        self.fallback_ytdlp(url, &post_id).await\n    }\n}","handlingStrategy":"fallback","validationCode":"fn embed_has_media(data: &serde_json::Value) -> bool {\n    data.get(\"video_url\").map_or(false, |v| v.is_string())\n        || data.get(\"display_url\").map_or(false, |v| v.is_string())\n}","typeGuard":"fn has_media_url(v: &serde_json::Value) -> bool {\n    v.get(\"video_url\").and_then(|x| x.as_str()).is_some()\n        || v.get(\"display_url\").and_then(|x| x.as_str()).is_some()\n}","tryCatchPattern":"match extract_media_from_embed(&html) {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"No media found in embed\") => {\n        downloader.fallback_ytdlp(url, &post_id).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Manually verify the embed URL renders media when this error recurs for a specific post","Keep the yt-dlp fallback enabled; yt-dlp tracks Instagram markup upstream","Inspect fetched HTML for consent/login-wall markers and switch to cookie-authenticated or proxied requests","Add regression fixtures of embed HTML so selector updates are caught in CI"],"tags":["instagram","html-parsing","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"}