- let (iframely_response, pictrs_thumbnail) =
- fetch_iframely_and_pictrs_data(context.client(), data_url).await?;
- let (embed_title, embed_description, embed_html) = iframely_response
- .map(|u| (u.title, u.description, u.html))
- .unwrap_or((None, None, None));
-
- let post_form = PostForm {
- creator_id: orig_post.creator_id.to_owned(),
- community_id: orig_post.community_id,
- name: data.name.to_owned().unwrap_or(orig_post.name),
- url: data_url.map(|u| clean_url_params(u.to_owned()).into()),
- body: data.body.to_owned(),
- nsfw: data.nsfw,
- updated: Some(naive_now()),
- embed_title,
- embed_description,
- embed_html,
- thumbnail_url: pictrs_thumbnail.map(|u| u.into()),
- ..PostForm::default()
- };
+ let (metadata_res, thumbnail_url) =
+ fetch_site_data(context.client(), context.settings(), data_url, true).await;
+ let (embed_title, embed_description, embed_video_url) = metadata_res
+ .map(|u| (Some(u.title), Some(u.description), Some(u.embed_video_url)))
+ .unwrap_or_default();