mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-21 09:31:19 +02:00
Decode HTML Entities inside Tweet
This commit is contained in:
@@ -37,6 +37,9 @@ use mammut::{
|
|||||||
// reqwest
|
// reqwest
|
||||||
use reqwest::blocking::Client;
|
use reqwest::blocking::Client;
|
||||||
|
|
||||||
|
// htmlescape
|
||||||
|
use htmlescape::decode_html;
|
||||||
|
|
||||||
/**********
|
/**********
|
||||||
* Generic usage functions
|
* Generic usage functions
|
||||||
***********/
|
***********/
|
||||||
@@ -144,9 +147,9 @@ fn build_basic_status(tweet: &Tweet) -> Result<StatusBuilder, Box<dyn Error>> {
|
|||||||
toot = toot.replace(&decoded_url.0, &decoded_url.1);
|
toot = toot.replace(&decoded_url.0, &decoded_url.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the & and replace it with &
|
if let Ok(t) = decode_html(&toot) {
|
||||||
// this is the only entities and/or char that is not available via Twitter API
|
toot = t;
|
||||||
toot = toot.replace("&", "&");
|
}
|
||||||
|
|
||||||
Ok(StatusBuilder::new(toot))
|
Ok(StatusBuilder::new(toot))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user