mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Always save page HTML
This commit is contained in:
parent
1ff1f1417a
commit
1a95ad6f59
17
src/ilias.rs
17
src/ilias.rs
@ -251,23 +251,8 @@ impl ILIAS {
|
|||||||
let html = self.get_html(&url.url).await?;
|
let html = self.get_html(&url.url).await?;
|
||||||
|
|
||||||
let main_text = if let Some(el) = html.select(&IL_CONTENT_CONTAINER).next() {
|
let main_text = if let Some(el) = html.select(&IL_CONTENT_CONTAINER).next() {
|
||||||
if !el
|
|
||||||
.children()
|
|
||||||
.flat_map(|x| x.value().as_element())
|
|
||||||
.next()
|
|
||||||
.map(|x| x.attr("class").unwrap_or_default().contains("ilContainerBlock"))
|
|
||||||
.unwrap_or(false)
|
|
||||||
&& el.inner_html().len() > 40
|
|
||||||
{
|
|
||||||
// ^ minimum length of useful content?
|
|
||||||
// specify a base URL for relative links
|
// specify a base URL for relative links
|
||||||
let mut link_base = format!(r#"<base href="{}">"#, ILIAS_URL);
|
Some(format!(r#"<base href="{}">{}"#, ILIAS_URL, el.inner_html()))
|
||||||
link_base += &el.inner_html();
|
|
||||||
Some(link_base)
|
|
||||||
} else {
|
|
||||||
// first element is the content overview => no custom text (?)
|
|
||||||
None
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user