use reqwest;
use scraper::{html::Select, Html, Selector};
async fn get_links() -> Result<Select, reqwest::Error> {
let res =
reqwest::get("http://site.com/links.html).await?;
let text = res.text().await?;
let doc = Html::parse_document(&text);
let sel = Selector::parse(
"a.links",
)
let links = doc.select(&sel);
---- `sel` is borrowed here
Ok(links)
^^^^^^^^^^ returns a value referencing data owned by the current function
}
Hello,
Here links
is an iterator, do you want to return one? You could also collect
.
Ok(links.collect())
| ^^^^^^^^^^^^^^^^ value of type `scraper::html::Select<'_, '_>` cannot be built from `std::iter::Iterator<Item=scraper::element_ref::ElementRef<'_>>`
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.