mirror of
https://framagit.org/veretcle/oolatoocs.git
synced 2025-07-20 20:41:17 +02:00
Almost initial commit
This commit is contained in:
18
src/lib.rs
18
src/lib.rs
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user