move info stuff into one file

This commit is contained in:
Mylloon 2022-08-15 12:20:16 +02:00
parent 1c1166ab06
commit 52419d899b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 17 additions and 13 deletions

15
src/info.rs Normal file
View file

@ -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<Html, Box<dyn std::error::Error>> {
/* 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))
}

View file

@ -1,21 +1,10 @@
use scraper::Html;
mod timetable; mod timetable;
mod info;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
let _timetable = timetable::timetable(3, 1, None).await; let _timetable = timetable::timetable(3, 1, None).await;
let _document_info = get_webpage_info().await.expect("Can't reach info website."); let _info = info::info().await;
// println!("{:#?}", document_info);
}
async fn get_webpage_info() -> Result<Html, Box<dyn std::error::Error>> {
/* 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))
} }