From 80c6b51d01810725fe02f63f8d95834f2333f6bb Mon Sep 17 00:00:00 2001 From: Maddox Werts Date: Sat, 2 Aug 2025 16:23:25 -0400 Subject: [PATCH] Backend properly implements TOKIO & Scraper --- project/src/backend.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/project/src/backend.rs b/project/src/backend.rs index b64a45b..94d7880 100644 --- a/project/src/backend.rs +++ b/project/src/backend.rs @@ -1,8 +1,9 @@ // Libraries mod calculator; -use std::io::Result; - +mod scraper; use calculator::{CalculationResult, Calculator}; +use scraper::Scraper; +use std::io::Result; // Structures pub struct Backend { @@ -22,11 +23,18 @@ impl Backend { /// ```rs /// let backend = Backend::new(true)?; /// ``` - pub fn new(fetch: bool) -> Result { + pub async fn new(fetch: bool) -> Result { // Did we want to fetch our prices? let memberships: Vec = if fetch { - // Use Internet to get prices - unimplemented!("TODO: Implement online Membership Price Fetching"); + // Getting the URL to scrape from + let scrape_url = + "https://www.washluberepair.com/location/frederick-auto-spa-express-rt-85/"; + + // Fetching with our Scraper + let scraper = Scraper::new(scrape_url); + + // Scraping + scraper.start().await? } else { // Manually creating our prices vec![