pub trait ScraperMain: Sized {
    fn scrape(doc: &Document, container: Option<&Node>) -> Result<Self>;
}
Expand description

Used to scrape data for a struct.

An example of this would look like with macros:

pub struct RedditListItem {
    pub url: String
}

impl ScraperMain for RedditListItem {
    fn scrape(doc: &Document, container: Option<Node>) -> Result<Self> {
       Ok(Self {
            url: evaluate(".//a[@data-click-id=\"body\"]/@href", doc, container).convert_from(doc)?
        })
    }
}

Required Methods§

Implementors§