This commit is contained in:
Marc Planard 2023-10-14 23:29:18 +02:00
parent d8ee59b964
commit 72e310c101

View File

@ -1,5 +1,5 @@
use scraper::{Html,Selector}; use scraper::{Html,Selector};
use url::{Url,Host}; use url::Url;
use std::sync::{Arc,Mutex}; use std::sync::{Arc,Mutex};
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use futures::future; use futures::future;
@ -14,7 +14,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.unwrap_or_else(|| "https://www.tmplab.org".to_string()); .unwrap_or_else(|| "https://www.tmplab.org".to_string());
let links = get_links(addr.as_ref()).await?; let links = get_links(addr.as_ref()).await?;
let addr = Url::parse(addr.as_ref())?; let addr = Url::parse(addr.as_ref())?;
let mut links : Vec<Url> = links.into_iter() let links : Vec<Url> = links.into_iter()
.filter(| url | url.host() != addr.host()) .filter(| url | url.host() != addr.host())
.collect(); .collect();