Almost initial commit

This commit is contained in:
VC
2023-11-07 17:14:49 +01:00
parent e8c2d35e21
commit 8c7e60881b
5 changed files with 444 additions and 38 deletions

View File

@@ -9,6 +9,10 @@ mod mastodon;
use mastodon::get_mastodon_timeline_since;
pub use mastodon::register;
mod utils;
use utils::strip_mastodon_tags;
use dissolve::strip_html_tags;
use rusqlite::Connection;
#[tokio::main]
@@ -25,6 +29,18 @@ pub async fn run(config: &Config) {
.unwrap_or_else(|e| panic!("Cannot get instance: {}", e));
for toot in timeline {
println!("{:?}", &toot.content);
let mut tweet_content = strip_html_tags(
&toot
.content
.replace("</p><p>", "\n\n")
.replace("<br />", "\n"),
)
.join("");
strip_mastodon_tags(&mut tweet_content, &toot.tags).unwrap();
tweet_content = tweet_content.trim_end_matches('\n').trim_end_matches(' ').to_string();
println!("{:?}", tweet_content);
}
}