From 2e0e1a1aaab5e020365e06343e5d9def30a46466 Mon Sep 17 00:00:00 2001 From: Butter Cat Date: Sun, 2 Feb 2025 23:31:37 -0500 Subject: [PATCH] Fix crossposted galleries not working (#293) --- src/utils.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils.rs b/src/utils.rs index 1bc70b9..c4991d8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -234,6 +234,14 @@ impl Media { // If this post contains a gallery of images gallery = GalleryMedia::parse(&data["gallery_data"]["items"], &data["media_metadata"]); + ("gallery", &data["url"], None) + } else if data["crosspost_parent_list"][0]["is_gallery"].as_bool().unwrap_or_default() { + // If this post contains a gallery of images + gallery = GalleryMedia::parse( + &data["crosspost_parent_list"][0]["gallery_data"]["items"], + &data["crosspost_parent_list"][0]["media_metadata"], + ); + ("gallery", &data["url"], None) } else if data["is_reddit_media_domain"].as_bool().unwrap_or_default() && data["domain"] == "i.redd.it" { // If this post contains a reddit media (image) URL.