From 2804a8ab38d2855253ce31451b628a6d9d691507 Mon Sep 17 00:00:00 2001
From: VC
", "\n\n")
- .replace("
", "\n"),
- )
- .join("");
-
- strip_mastodon_tags(&mut tweet_content, &toot.tags).unwrap();
-
- tweet_content = tweet_content
- .trim_end_matches('\n')
- .trim_end_matches(' ')
- .to_string();
-
+ let Ok(tweet_content) = strip_everything(&toot.content, &toot.tags) else {
+ continue;
+ };
println!("{:?}", tweet_content);
}
}
diff --git a/src/utils.rs b/src/utils.rs
index 59406af..8cd4004 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -1,11 +1,24 @@
+use dissolve::strip_html_tags;
use megalodon::entities::status::Tag;
use regex::Regex;
use std::error::Error;
-pub fn strip_mastodon_tags(content: &mut String, tags: &Vec
", "\n\n").replace("
", "\n")).join("");
+
+ strip_mastodon_tags(&mut res, tags).unwrap();
+
+ res = res.trim_end_matches('\n').trim_end_matches(' ').to_string();
+
+ Ok(res)
+}
+
+fn strip_mastodon_tags(content: &mut String, tags: &Vec