1
0
Fork 0
mirror of https://gitlab.com/news-flash/article_scraper.git synced 2025-07-07 08:05:31 +02:00
This commit is contained in:
Jan Lukas Gernert 2024-02-13 19:36:58 +01:00
parent a1ee3b22f9
commit 0dcebe8b49

View file

@ -1,5 +1,3 @@
use std::collections::HashSet;
use std::fmt::Write;
use libxml::{
tree::{Document, Node, NodeType, SaveOptions},
xpath::Context,
@ -8,6 +6,8 @@ use reqwest::{
header::{HeaderMap, HeaderName, HeaderValue, CONTENT_LENGTH, CONTENT_TYPE},
Response,
};
use std::collections::HashSet;
use std::fmt::Write;
use tokio::fs::DirEntry;
use crate::{
@ -204,13 +204,13 @@ impl Util {
let node_vec = Util::evaluate_xpath(context, xpath, true)?;
let mut val = String::new();
for node in node_vec {
let part = node
.get_content()
.split_whitespace()
.fold(String::new(), |mut output, s| {
let _ = write!(output, " {s}");
output
});
let part =
node.get_content()
.split_whitespace()
.fold(String::new(), |mut output, s| {
let _ = write!(output, " {s}");
output
});
val.push_str(&part);
val.push(' ');
}