cleanup
This commit is contained in:
parent
d8ee59b964
commit
72e310c101
@ -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,10 +14,10 @@ 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();
|
||||||
|
|
||||||
let links = Arc::new(Mutex::new(links));
|
let links = Arc::new(Mutex::new(links));
|
||||||
|
|
||||||
let joins = (0..WORKERS)
|
let joins = (0..WORKERS)
|
||||||
|
Loading…
Reference in New Issue
Block a user