extrablatt_v2 0.5.0

News, articles and text scraper
Documentation
1
2
3
4
5
6
7
8
9
10
11
use reqwest::Url;
use select::document::Document;
use select::predicate::Name;

/// Finds the href in the `<base>` tag.
pub fn base_url(doc: &Document) -> Option<Url> {
    doc.find(Name("base"))
        .filter_map(|n| n.attr("href"))
        .filter_map(|href| Url::parse(href).ok())
        .next()
}