Function url_crawl::get_urls

source ·
pub fn get_urls(html: &str) -> impl Iterator<Item = &str>
Expand description

Extracts the links from html. This can be used to HTTP/2 push the linked resources.

Gets

  • <link> nodes where rel != preconnect
  • all nodes with a src attribute

ToDo: Add background-image and other css link detection

Examples found in repository?
examples/icelk.dev.rs (line 137)
133
134
135
136
137
138
139
140
fn main() {
    let time = std::time::Instant::now();
    println!(
        "Found URLs: {:#?}. Took {} μs.",
        url_crawl::get_urls(HTML).collect::<Vec<_>>(),
        time.elapsed().as_micros()
    );
}