diff --git a/src/main.rs b/src/main.rs index 6dc0b99..9738c2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -163,6 +163,7 @@ mod selectors { lazy_static!{ pub static ref a: Selector = Selector::parse("a").unwrap(); pub static ref a_target_blank: Selector = Selector::parse(r#"a[target="_blank"]"#).unwrap(); + pub static ref img: Selector = Selector::parse("img").unwrap(); pub static ref table: Selector = Selector::parse("table").unwrap(); pub static ref video_tr: Selector = Selector::parse(".ilTableOuter > div > table > tbody > tr").unwrap(); pub static ref links_in_table: Selector = Selector::parse("tbody tr td a").unwrap(); @@ -172,6 +173,7 @@ mod selectors { pub static ref post_title: Selector = Selector::parse(".ilFrmPostTitle").unwrap(); pub static ref post_container: Selector = Selector::parse(".ilFrmPostContentContainer").unwrap(); pub static ref post_content: Selector = Selector::parse(".ilFrmPostContent").unwrap(); + pub static ref post_attachments: Selector = Selector::parse(".ilFrmPostAttachmentsContainer").unwrap(); pub static ref span_small: Selector = Selector::parse("span.small").unwrap(); pub static ref forum_pages: Selector = Selector::parse("div.ilTableNav > table > tbody > tr > td > a").unwrap(); pub static ref alert_danger: Selector = Selector::parse("div.alert-danger").unwrap(); @@ -180,6 +182,7 @@ mod selectors { pub static ref form_name: Selector = Selector::parse(".il_InfoScreenProperty").unwrap(); pub static ref cmd_node_regex: Regex = Regex::new(r#"cmdNode=uf:\w\w"#).unwrap(); + pub static ref image_src_regex: Regex = Regex::new(r#"\./data/produktiv/mobs/mm_(\d+)/([^?]+).+"#).unwrap(); } } use crate::selectors::*; @@ -299,7 +302,9 @@ fn process(ilias: Arc, mut path: PathBuf, obj: Object) -> impl Future, mut path: PathBuf, obj: Object) -> impl Future, mut path: PathBuf, obj: Object) -> impl Future().replace('/', "-"); @@ -436,7 +444,8 @@ fn process(ilias: Arc, mut path: PathBuf, obj: Object) -> impl Future, mut path: PathBuf, obj: Object) -> impl Future(), attachment.value().attr("href").map(|x| x.to_owned()))); + } + } } // pagination if let Some(pages) = html.select(&table).next() { @@ -456,12 +475,38 @@ fn process(ilias: Arc, mut path: PathBuf, obj: Object) -> impl Future { create_dir(&path).await?;