load html file
This commit is contained in:
parent
8bdb83a406
commit
b9c7a79afc
1 changed files with 20 additions and 2 deletions
22
src/main.rs
22
src/main.rs
|
@ -1,3 +1,21 @@
|
|||
fn main() {
|
||||
println!("cal8tor");
|
||||
use scraper::{Html, Selector};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
//let url = "https://informatique.up8.edu/licence-iv/edt/l3.html";
|
||||
|
||||
// Get raw html
|
||||
//let html = reqwest::get(url).await?.text().await?;
|
||||
let html = include_str!("../target/debug.html");
|
||||
|
||||
// Parse document
|
||||
let document = Html::parse_document(&html);
|
||||
|
||||
// Find the timetable
|
||||
let selector = Selector::parse("table").unwrap();
|
||||
let raw_timetable = document.select(&selector);
|
||||
|
||||
println!("{:#?}", raw_timetable);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Reference in a new issue