mirror of
https://gitlab.com/news-flash/article_scraper.git
synced 2025-07-07 16:15:32 +02:00
fmt
This commit is contained in:
parent
a1ee3b22f9
commit
0dcebe8b49
1 changed files with 9 additions and 9 deletions
|
@ -1,5 +1,3 @@
|
||||||
use std::collections::HashSet;
|
|
||||||
use std::fmt::Write;
|
|
||||||
use libxml::{
|
use libxml::{
|
||||||
tree::{Document, Node, NodeType, SaveOptions},
|
tree::{Document, Node, NodeType, SaveOptions},
|
||||||
xpath::Context,
|
xpath::Context,
|
||||||
|
@ -8,6 +6,8 @@ use reqwest::{
|
||||||
header::{HeaderMap, HeaderName, HeaderValue, CONTENT_LENGTH, CONTENT_TYPE},
|
header::{HeaderMap, HeaderName, HeaderValue, CONTENT_LENGTH, CONTENT_TYPE},
|
||||||
Response,
|
Response,
|
||||||
};
|
};
|
||||||
|
use std::collections::HashSet;
|
||||||
|
use std::fmt::Write;
|
||||||
use tokio::fs::DirEntry;
|
use tokio::fs::DirEntry;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -204,13 +204,13 @@ impl Util {
|
||||||
let node_vec = Util::evaluate_xpath(context, xpath, true)?;
|
let node_vec = Util::evaluate_xpath(context, xpath, true)?;
|
||||||
let mut val = String::new();
|
let mut val = String::new();
|
||||||
for node in node_vec {
|
for node in node_vec {
|
||||||
let part = node
|
let part =
|
||||||
.get_content()
|
node.get_content()
|
||||||
.split_whitespace()
|
.split_whitespace()
|
||||||
.fold(String::new(), |mut output, s| {
|
.fold(String::new(), |mut output, s| {
|
||||||
let _ = write!(output, " {s}");
|
let _ = write!(output, " {s}");
|
||||||
output
|
output
|
||||||
});
|
});
|
||||||
val.push_str(&part);
|
val.push_str(&part);
|
||||||
val.push(' ');
|
val.push(' ');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue