change types in Page and change variable names to align better with the intended struct
This commit is contained in:
parent
de4fece245
commit
ac4f30ce9e
10
src/lib.rs
10
src/lib.rs
|
@ -55,8 +55,8 @@ pub struct Config {
|
||||||
|
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
pub date: String,
|
pub date: String,
|
||||||
pub next_page: bool,
|
pub next_page: Option<String>,
|
||||||
pub prev_page: bool,
|
pub prev_page: Option<String>,
|
||||||
pub image: String,
|
pub image: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ pub async fn get_page(date: String) {
|
||||||
|
|
||||||
let parsed = Html::parse_document(page_html);
|
let parsed = Html::parse_document(page_html);
|
||||||
|
|
||||||
|
// get image url for this page
|
||||||
let selector = Selector::parse("img[alt=Comic]").unwrap();
|
let selector = Selector::parse("img[alt=Comic]").unwrap();
|
||||||
let mut url = String::new();
|
let mut image = String::new();
|
||||||
for element in parsed.select(&selector) {
|
for element in parsed.select(&selector) {
|
||||||
url = element.value().attr("src").unwrap().replace('"', "");
|
image = element.value().attr("src").unwrap().replace('"', "");
|
||||||
}
|
}
|
||||||
println!("{url}");
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue