feat: add links in fields attribute

This commit is contained in:
VC
2022-12-14 10:18:30 +01:00
parent 3fdd81df50
commit 6ffcbfc89a
7 changed files with 130 additions and 122 deletions

View File

@@ -4,7 +4,11 @@ use base64::encode;
use egg_mode::tweet::Tweet;
use futures::{stream, stream::StreamExt};
use log::{error, info, warn};
use megalodon::{mastodon::Mastodon, megalodon::Megalodon};
use megalodon::{
entities::UploadMedia::{AsyncAttachment, Attachment},
mastodon::Mastodon,
megalodon::Megalodon,
};
use reqwest::Url;
use std::error::Error;
use tokio::{
@@ -49,7 +53,12 @@ pub async fn generate_media_ids(
// it doesnt matter if we cant remove, cache_media fn is idempotent
remove_file(&local_tweet_media_path).await.ok();
Ok::<String, ScootalooError>(mastodon_media.id)
let id = match mastodon_media {
Attachment(m) => m.id,
AsyncAttachment(m) => m.id,
};
Ok::<String, ScootalooError>(id)
})
})
.buffered(4); // there are max four medias per tweet and they need to be treated in