mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Simplify link extractor
This commit is contained in:
parent
38ee7ed31e
commit
b44c31d8d4
@ -29,8 +29,7 @@ static IL_CONTENT_CONTAINER: Lazy<Selector> = Lazy::new(|| Selector::parse("#il_
|
|||||||
static BLOCK_FAVORITES: Lazy<Selector> = Lazy::new(|| Selector::parse("#block_pditems_0").unwrap());
|
static BLOCK_FAVORITES: Lazy<Selector> = Lazy::new(|| Selector::parse("#block_pditems_0").unwrap());
|
||||||
static ITEM_PROP: Lazy<Selector> = Lazy::new(|| Selector::parse("span.il_ItemProperty").unwrap());
|
static ITEM_PROP: Lazy<Selector> = Lazy::new(|| Selector::parse("span.il_ItemProperty").unwrap());
|
||||||
static CONTAINER_ITEMS: Lazy<Selector> = Lazy::new(|| Selector::parse("div.il_ContainerListItem, .il-std-item").unwrap());
|
static CONTAINER_ITEMS: Lazy<Selector> = Lazy::new(|| Selector::parse("div.il_ContainerListItem, .il-std-item").unwrap());
|
||||||
static CONTAINER_ITEM_TITLE: Lazy<Selector> = Lazy::new(|| Selector::parse("a.il_ContainerItemTitle").unwrap());
|
static CONTAINER_ITEM_TITLE: Lazy<Selector> = Lazy::new(|| Selector::parse("a.il_ContainerItemTitle, .il-item-title > a").unwrap());
|
||||||
static CONTAINER_ITEM_TITLE_ALTERNATIVE: Lazy<Selector> = Lazy::new(|| Selector::parse(".il-item-title > a").unwrap());
|
|
||||||
|
|
||||||
pub struct ILIAS {
|
pub struct ILIAS {
|
||||||
pub opt: Opt,
|
pub opt: Opt,
|
||||||
@ -261,7 +260,6 @@ impl ILIAS {
|
|||||||
.flat_map(|item| {
|
.flat_map(|item| {
|
||||||
item.select(&CONTAINER_ITEM_TITLE)
|
item.select(&CONTAINER_ITEM_TITLE)
|
||||||
.next()
|
.next()
|
||||||
.or_else(|| item.select(&CONTAINER_ITEM_TITLE_ALTERNATIVE).next())
|
|
||||||
.map(|link| Object::from_link(item, link))
|
.map(|link| Object::from_link(item, link))
|
||||||
// items without links are ignored
|
// items without links are ignored
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user