Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

fix(instagram): download reel video instead of cover image (#282)

Simon Bachae1ee7f507d1
diff --git a/src-tauri/omniget-core/src/platforms/instagram.rs b/src-tauri/omniget-core/src/platforms/instagram.rs
index cc4efd41..a14f4211 100644
--- a/src-tauri/omniget-core/src/platforms/instagram.rs
+++ b/src-tauri/omniget-core/src/platforms/instagram.rs
@@ -111,6 +111,14 @@ impl InstagramDownloader {
false
}
+ fn is_reel_url(url: &str) -> bool {
+ if let Ok(parsed) = url::Url::parse(url) {
+ let path = parsed.path().to_lowercase();
+ return path.starts_with("/reel/") || path.starts_with("/reels/");
+ }
+ false
+ }
+
async fn resolve_share_link(&self, share_id: &str) -> anyhow::Result<String> {
let url = format!("https://www.instagram.com/share/{}/", share_id);
@@ -697,6 +705,24 @@ impl PlatformDownloader for InstagramDownloader {
}
};
+ // Instagram embed metadata can expose only a Reel's display_url,
+ // which is the cover image rather than the video. In that case,
+ // use yt-dlp to resolve and download the actual video streams.
+ if Self::is_reel_url(url)
+ && matches!(
+ &media,
+ InstagramMedia::Single {
+ is_video: false,
+ ..
+ }
+ )
+ {
+ tracing::debug!(
+ "[instagram] Reel embed returned only a display image; falling back to yt-dlp"
+ );
+ return self.fallback_ytdlp(url, &post_id).await;
+ }
+
match media {
InstagramMedia::Single { url, is_video } => {
let (media_type, format) = if is_video {
@@ -916,6 +942,30 @@ mod tests {
}
}
+ #[test]
+ fn is_reel_url_accepts_reel_paths() {
+ assert!(InstagramDownloader::is_reel_url(
+ "https://www.instagram.com/reel/Dbi_MeVOphM/"
+ ));
+ assert!(InstagramDownloader::is_reel_url(
+ "https://www.instagram.com/reels/Dbi_MeVOphM/"
+ ));
+ }
+
+ #[test]
+ fn is_reel_url_rejects_regular_posts() {
+ assert!(!InstagramDownloader::is_reel_url(
+ "https://www.instagram.com/p/Dbi_MeVOphM/"
+ ));
+ }
+
+ #[test]
+ fn is_reel_url_handles_case_insensitive_paths() {
+ assert!(InstagramDownloader::is_reel_url(
+ "https://www.instagram.com/REEL/Dbi_MeVOphM/"
+ ));
+ }
+
#[test]
fn post_url_from_title_accepts_prefixed_title() {
assert_eq!(