From c918e9ef3a66c00841ae753aa742b26071f4e3ca Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 13 Aug 2022 15:50:14 +0200 Subject: [PATCH] Fix missing reddit api mapping Signed-off-by: trivernis --- .gitignore | 1 + src/operations/find_and_send_reddit_posts.rs | 1 + src/utils/reddit.rs | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 51fd28d..1da0671 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target reddit-urls.txt +reddt-urls.txt diff --git a/src/operations/find_and_send_reddit_posts.rs b/src/operations/find_and_send_reddit_posts.rs index a898b5a..548871b 100644 --- a/src/operations/find_and_send_reddit_posts.rs +++ b/src/operations/find_and_send_reddit_posts.rs @@ -8,6 +8,7 @@ pub async fn find_and_send_reddit_posts(hydrus: &Hydrus, post_urls: Vec) for (index, post) in post_urls.into_iter().enumerate() { tracing::info!("Importing post {} of {}", index + 1, total_posts); + tracing::debug!("Post {}", post); let images = get_post_images(&post).await?; tracing::info!("Found {} images for post {}", images.len(), post); diff --git a/src/utils/reddit.rs b/src/utils/reddit.rs index b7f1992..a8808d6 100644 --- a/src/utils/reddit.rs +++ b/src/utils/reddit.rs @@ -25,6 +25,8 @@ enum DataEntryChild { T3(T3Data), #[serde(alias = "t1")] T1(HashMap), + #[serde(alias = "more")] + More(HashMap), } #[derive(Deserialize, Debug)] @@ -78,7 +80,7 @@ async fn get_post(url: &str) -> Result { match entry { DataEntryChild::T3(t3) => Ok(t3), - DataEntryChild::T1(_) => panic!("Invalid data entry t1"), + DataEntryChild::T1(_) | DataEntryChild::More(_) => panic!("Invalid data entry t1 or more"), } }