Skip to content

Instantly share code, notes, and snippets.

@FluffyDietEngine
Created October 24, 2023 15:33
Show Gist options
  • Save FluffyDietEngine/7ed0642ea97b6088b81fa369955528d5 to your computer and use it in GitHub Desktop.
Save FluffyDietEngine/7ed0642ea97b6088b81fa369955528d5 to your computer and use it in GitHub Desktop.
//[dependencies]
// reqwest = { version = "0.10.0-alpha.2", features = ["blocking"] }
// tl = "0.7.7"
extern crate reqwest;
extern crate tl;
use std::time::Instant;
// need to add return type
fn main() {
let url = "https://en.wikipedia.org/wiki/Lists_of_books";
let client = reqwest::blocking::Client::new();
let resp = client.get(url).send().unwrap();
let body = resp.text().unwrap();
let start = Instant::now();
let dom = tl::parse(&body, tl::ParserOptions::default()).unwrap();
let _anchors = dom.query_selector("a[href]").unwrap();
// meed to return _anchors from here. I could not find the data type
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment