diff --git a/Cargo.toml b/Cargo.toml index a487742..e81f8ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "obsessed-yanqing" -version = "1.4.6" +version = "1.4.7" edition = "2021" authors = ["Evann Regnault"] license = "MIT" diff --git a/src/commands/events.rs b/src/commands/events.rs index 97a9c32..5966cd3 100644 --- a/src/commands/events.rs +++ b/src/commands/events.rs @@ -220,15 +220,17 @@ fn get_event_type(event: Node, description: &Option<(String, String)>) -> EventT } fn get_banner_data(event: Node) -> Option { - let five_stars = event.find(Class("rarity-5").descendant(Name("picture")).descendant(Name("img"))).next().map(|x| x.attr("alt").expect("No alt on five star image").to_string()); - let four_stars = event.find(Class("rarity-4")).take(3).map(|four_stars_node| { - four_stars_node.find(Name("picture").descendant(Name("img"))).next().map(|x| x.attr("alt").expect("No alt on four star image").to_string()).expect("Cannot get four stars names") + let five_stars = event.find(Class("rarity-5").and(Class("avatar").or(Class("hsr-set-image"))).descendant(Name("picture").descendant(Name("img")))).next().map(|x|{ + x.attr("alt").expect("Cannot get five star") + }).or(None); + let four_stars = event.find(Class("rarity-4").and(Class("avatar").or(Class("hsr-set-image")))).take(3).map(|four_stars_node| { + four_stars_node.find(Name("picture").descendant(Name("img"))).next().map(|x| x.attr("alt").expect("Cannot get four stars").to_string()).expect("") }).collect::>(); match five_stars { None => None, Some(x) => match four_stars.len() { - 3 => Some(BannerData { five_stars: x, four_stars }), + 3 => Some(BannerData { five_stars: x.to_string(), four_stars }), _ => None } }