1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use serde::Serialize;
use error::ScraperError;
use fetch::fetch_schedules_in_stop;
use parser::parse_html;
pub mod error;
mod fetch;
mod parser;
#[derive(Debug, PartialEq, Serialize)]
pub struct Schedule {
line: String,
time: String,
destination: String,
stop: String,
}
pub fn fetch_next_buses(stop_code: &str) -> Result<Vec<Schedule>, ScraperError> {
let html = fetch_schedules_in_stop(stop_code, None)?;
let result = parse_html(stop_code, &html)?;
Ok(result)
}