0

Using "OpenGraph" crate. For my project all I need is URL of the image scraped from the required website, the documentation seems to imply you can just get the image part but the function for the image doesn't take in a URL to scrape from or the scraped data? The output is also strange so I'm not sure how to serialise it to JSON to extract the data or if that's even a legitimate way to do it?

    match opengraph::scrape(&url[..], Default::default()) {
        Ok(object) => {
            println!("{:?}", object);
        },Err(_) => println!("error occured"),
    }

Gets output but in an object, Serialising doesn't seem to work but I could be doing it wrong.

pub fn extract_image(attrs: &Vec<Attribute>) -> Option<Image>

Stated in documentation but doesn't work, also not sure how to input as a Vec since the scrape is a object.

0 Answers0