From 52419d899b620dba5deebfdfe2ac280714cfc9df Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 15 Aug 2022 12:20:16 +0200 Subject: [PATCH] move info stuff into one file --- src/info.rs | 15 +++++++++++++++ src/main.rs | 15 ++------------- 2 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 src/info.rs diff --git a/src/info.rs b/src/info.rs new file mode 100644 index 0000000..f43b608 --- /dev/null +++ b/src/info.rs @@ -0,0 +1,15 @@ +use scraper::Html; + +pub async fn info() { + let _document_info = get_webpage().await.expect("Can't reach info website."); + // println!("{:#?}", document_info); +} + +async fn get_webpage() -> Result> { + /* let html = reqwest::get("https://informatique.up8.edu/licence-iv/edt").await?.text().await?; + + Ok(Html::parse_document(&html)) */ + + let html = include_str!("../target/debug2.html"); + Ok(Html::parse_document(html)) +} diff --git a/src/main.rs b/src/main.rs index cab88fb..a66dc42 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,21 +1,10 @@ -use scraper::Html; - mod timetable; +mod info; #[tokio::main] async fn main() { let _timetable = timetable::timetable(3, 1, None).await; - let _document_info = get_webpage_info().await.expect("Can't reach info website."); - // println!("{:#?}", document_info); -} - -async fn get_webpage_info() -> Result> { - /* let html = reqwest::get("https://informatique.up8.edu/licence-iv/edt").await?.text().await?; - - Ok(Html::parse_document(&html)) */ - - let html = include_str!("../target/debug2.html"); - Ok(Html::parse_document(html)) + let _info = info::info().await; }