fix: fix typo

This commit is contained in:
Embers-of-the-Fire 2024-08-01 10:42:11 +08:00
parent 422e95792a
commit 7601cdaf9d

View File

@ -328,7 +328,7 @@ fn execute_selector_query_with_attribute(
let doc = Html::parse_fragment(input_string); let doc = Html::parse_fragment(input_string);
let vals: Vec<Value> = doc let vals: Vec<Value> = doc
.select(&failable_css(query_string, inspect)?) .select(&fallible_css(query_string, inspect)?)
.map(|selection| { .map(|selection| {
Value::string( Value::string(
selection.value().attr(attribute).unwrap_or("").to_string(), selection.value().attr(attribute).unwrap_or("").to_string(),
@ -358,7 +358,7 @@ fn execute_selector_query_with_attributes(
} }
let vals: Vec<Value> = doc let vals: Vec<Value> = doc
.select(&failable_css(query_string, inspect)?) .select(&fallible_css(query_string, inspect)?)
.map(|selection| { .map(|selection| {
let mut record = Record::new(); let mut record = Record::new();
for attr in &attrs { for attr in &attrs {
@ -384,11 +384,11 @@ fn execute_selector_query(
let vals: Vec<Value> = match as_html { let vals: Vec<Value> = match as_html {
true => doc true => doc
.select(&failable_css(query_string, inspect)?) .select(&fallible_css(query_string, inspect)?)
.map(|selection| Value::string(selection.html(), span)) .map(|selection| Value::string(selection.html(), span))
.collect(), .collect(),
false => doc false => doc
.select(&failable_css(query_string, inspect)?) .select(&fallible_css(query_string, inspect)?)
.map(|selection| { .map(|selection| {
Value::list( Value::list(
selection selection
@ -404,7 +404,7 @@ fn execute_selector_query(
Ok(Value::list(vals, span)) Ok(Value::list(vals, span))
} }
fn failable_css( fn fallible_css(
selector: Spanned<String>, selector: Spanned<String>,
inspect: Spanned<bool>, inspect: Spanned<bool>,
) -> Result<ScraperSelector, LabeledError> { ) -> Result<ScraperSelector, LabeledError> {