diff --git a/src/post.rs b/src/post.rs index 3bf810d..1374087 100644 --- a/src/post.rs +++ b/src/post.rs @@ -102,6 +102,7 @@ async fn parse_post(json: &serde_json::Value) -> Post { url: format_url(val(post, "thumbnail").as_str()), width: post["data"]["thumbnail_width"].as_i64().unwrap_or_default(), height: post["data"]["thumbnail_height"].as_i64().unwrap_or_default(), + poster: "".to_string(), }, flair: Flair { flair_parts: parse_rich_flair( diff --git a/src/utils.rs b/src/utils.rs index 512784c..44e042a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -44,6 +44,7 @@ pub struct Media { pub url: String, pub width: i64, pub height: i64, + pub poster: String, } pub struct GalleryMedia { @@ -255,6 +256,7 @@ pub async fn media(data: &Value) -> (String, Media, Vec) { url, width: data["preview"]["images"][0]["source"]["width"].as_i64().unwrap_or_default(), height: data["preview"]["images"][0]["source"]["height"].as_i64().unwrap_or_default(), + poster: format_url(data["preview"]["images"][0]["source"]["url"].as_str().unwrap_or_default()), }, gallery, ) @@ -384,6 +386,7 @@ pub async fn fetch_posts(path: &str, fallback_title: String) -> Result<(Vec {% else if post.post_type == "video" || post.post_type == "gif" %} - + {% else if post.post_type == "gallery" %}