From b9c7a79afc7f74014d84a26ae31384266e4df7f5 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 12 Aug 2022 19:55:28 +0200 Subject: [PATCH] load html file --- src/main.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index cb8b937..174d748 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,21 @@ -fn main() { - println!("cal8tor"); +use scraper::{Html, Selector}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + //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(()) }