Function extract_icon_links_from_html

Source
pub fn extract_icon_links_from_html(
    html: &Html,
) -> Result<Vec<ElementRef<'_>>, Error>
Expand description

This function allows you to get all <link rel='icon'> on an Html page.

Example:


use favicon_picker::extract_icon_links_from_html;
use scraper::Html;
 
let html_raw = "
    <!DOCTYPE html>
    <html>
        <head>
            <link rel='icon' size='96x96' href='/some-favicon.ico'/>
            <link rel='icon' size='any' href='/favicon.ico'/>
        </head>
    </html>
";
let html = Html::parse_document(html_raw);
let icons = extract_icon_links_from_html(&html).unwrap();
assert_eq!(icons.len(), 2);