-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//! `cargo run --example url_glob --features glob` | ||
extern crate spider; | ||
|
||
use spider::tokio; | ||
use spider::website::Website; | ||
use std::time::Instant; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let mut website: Website = Website::new( | ||
"https://rsseau.fr/blog/{lazy-load-components,gnu-parallel,migrate-from-jekyll-to-gatsby}", | ||
); | ||
website | ||
.configuration | ||
.blacklist_url | ||
.insert(Default::default()) | ||
.push("https://rsseau.fr/resume".into()); | ||
|
||
let start = Instant::now(); | ||
website.crawl().await; | ||
let duration = start.elapsed(); | ||
|
||
let links = website.get_links(); | ||
|
||
for link in links { | ||
println!("- {:?}", link.as_ref()); | ||
} | ||
|
||
println!( | ||
"Time elapsed in website.crawl() is: {:?} for total pages: {:?}", | ||
duration, | ||
links.len() | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//! `cargo run --example url_glob_subdomains --features glob` | ||
extern crate spider; | ||
|
||
use spider::tokio; | ||
use spider::website::Website; | ||
use std::time::Instant; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let mut website: Website = Website::new("https://{www,docs}.a11ywatch.com") | ||
.with_subdomains(true) | ||
.build() | ||
.unwrap(); | ||
|
||
let start = Instant::now(); | ||
website.crawl().await; | ||
let duration = start.elapsed(); | ||
|
||
let links = website.get_links(); | ||
|
||
for link in links { | ||
println!("- {:?}", link.as_ref()); | ||
} | ||
|
||
println!( | ||
"Time elapsed in website.crawl() is: {:?} for total pages: {:?}", | ||
duration, | ||
links.len() | ||
) | ||
} |