Fix missing reddit api mapping

Signed-off-by: trivernis <trivernis@protonmail.com>
main
trivernis 2 years ago
parent bed1003f0b
commit c918e9ef3a
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

1
.gitignore vendored

@ -1,2 +1,3 @@
/target
reddit-urls.txt
reddt-urls.txt

@ -8,6 +8,7 @@ pub async fn find_and_send_reddit_posts(hydrus: &Hydrus, post_urls: Vec<String>)
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);

@ -25,6 +25,8 @@ enum DataEntryChild {
T3(T3Data),
#[serde(alias = "t1")]
T1(HashMap<String, Value>),
#[serde(alias = "more")]
More(HashMap<String, Value>),
}
#[derive(Deserialize, Debug)]
@ -78,7 +80,7 @@ async fn get_post(url: &str) -> Result<T3Data> {
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"),
}
}

Loading…
Cancel
Save