{"record":{"id":"654c275838249dd7","repo":"tonhowtf/omniget","slug":"no-media-found-in-threads-post","errorCode":null,"errorMessage":"No media found in Threads post","messagePattern":"No media found in Threads post","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/platforms/threads.rs","lineNumber":253,"sourceCode":"                }\n\n                if !items.is_empty() {\n                    return Ok(ThreadsMedia::Carousel { items });\n                }\n            }\n        }\n\n        // Media singolo\n        if let Some(item) = Self::extract_single_media(post)? {\n            return Ok(ThreadsMedia::Single {\n                url: item.url,\n                is_video: item.is_video,\n                width: item.width,\n                height: item.height,\n            });\n        }\n\n        Err(anyhow!(\"No media found in Threads post\"))\n    }\n\n    /// Estrae un singolo elemento media (video o immagine)\n    fn extract_single_media(media: &serde_json::Value) -> anyhow::Result<Option<CarouselItem>> {\n        // Le dimensioni stanno sul post, non sulle singole versioni\n        let original_width = media\n            .get(\"original_width\")\n            .and_then(|w| w.as_u64())\n            .unwrap_or(0) as u32;\n        let original_height = media\n            .get(\"original_height\")\n            .and_then(|h| h.as_u64())\n            .unwrap_or(0) as u32;\n\n        // Video: video_versions ha entries {type, url}; type più basso = qualità migliore\n        if let Some(video_versions) = media.get(\"video_versions\").and_then(|v| v.as_array()) {\n            if !video_versions.is_empty() {\n                if let Some(url) = video_versions","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/platforms/threads.rs#L235-L271","documentation":"extract_media_from_post in threads.rs parsed the post's bootstrap JSON successfully but found no image or video entries inside it. The library throws this when the post data exists yet carries no downloadable media, so it cannot build a MediaInfo with items.","triggerScenarios":"Calling get_media_info on a Threads post whose parsed JSON has an empty/absent media array — text-only posts, reposts without media, or posts whose media layout the extractor does not recognize.","commonSituations":"Users pasting links to text-only Threads posts expecting media; carousel posts where the extractor's media key path changed; images served in a variant shape the single-item extractor returns None for.","solutions":["Confirm the post actually contains an image or video in the app/browser","Check extract_media_from_post's JSON key paths against the current Threads post schema","Skip text-only posts upstream with a friendly 'no media in this post' message","Log the raw post JSON when this fires to catch schema drift early"],"exampleFix":"// before\nErr(anyhow!(\"No media found in Threads post\"))\n// after\nErr(anyhow!(\"No media found in Threads post (is_video-items: {})\", media_count))","handlingStrategy":"validation","validationCode":"if (!postHasMedia(postJson)) {\n  throw new Error(\"This Threads post contains no image or video\");\n}","typeGuard":"function hasMedia(post) {\n  return Array.isArray(post?.media) && post.media.length > 0;\n}","tryCatchPattern":"match threads.get_media_info(url).await {\n    Err(e) if e.to_string().contains(\"No media found\") => inform_user(\"Text-only Threads post\"),\n    other => other?,\n}","preventionTips":["Detect text-only posts early and skip them","Log raw post JSON when extraction returns nothing to catch schema drift","Update extractor key paths when Threads changes its media schema","Show 'no media' as an expected outcome, not a crash"],"tags":["threads","scraping","no-media"],"backgroundTag":"empty-result-set","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"}