Basic gallery support (#103)

This commit is contained in:
robrobinbin 2021-02-06 21:05:11 +01:00 committed by GitHub
parent 2a475d127a
commit cf45d53fdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 4 deletions

View file

@ -72,7 +72,7 @@ async fn parse_post(json: &serde_json::Value) -> Post {
let ratio: f64 = post["data"]["upvote_ratio"].as_f64().unwrap_or(1.0) * 100.0;
// Determine the type of media along with the media URL
let (post_type, media) = media(&post["data"]).await;
let (post_type, media, gallery) = media(&post["data"]).await;
// Build a post using data parsed from Reddit post API
Post {
@ -124,6 +124,7 @@ async fn parse_post(json: &serde_json::Value) -> Post {
rel_time,
created,
comments: format_num(post["data"]["num_comments"].as_i64().unwrap_or_default()),
gallery,
}
}