Fix NEW versions Again AAAA

main
kirbylife 2024-10-02 19:37:23 -06:00
parent beead99db8
commit 692b719b90
1 changed files with 22 additions and 18 deletions

View File

@ -122,24 +122,28 @@ pub fn search_crate(crate_name: String) -> Option<CrateInfo> {
if elem.css_once("del").is_some() { if elem.css_once("del").is_some() {
None None
} else if elem.css_once(".new").is_some() { } else if elem.css_once(".new").is_some() {
let version = elem let (version, date) = match elem.css_once("a") {
.css_once("a") Some(a) => {
.unwrap() let version = a.content().lines().nth(2).unwrap().trim().to_string();
.content() let date = elem
.lines() .css_once("*")
.nth(2) .unwrap()
.unwrap() .content()
.trim() .lines()
.to_string(); .nth(2)
let date = elem .unwrap()
.css_once("*") .trim()
.unwrap() .to_string();
.content() (version, date)
.lines() }
.nth(2) None => {
.unwrap() let binding = elem.css_once("*").unwrap().content();
.trim() let mut lines = binding.lines();
.to_string(); let version = lines.nth(1).unwrap().trim().to_string();
let date = lines.nth(1).unwrap().trim().to_string();
(version, date)
}
};
Some(Version::new(version, date)) Some(Version::new(version, date))
} else { } else {
let raw_data = elem.css_once("*").unwrap().content(); let raw_data = elem.css_once("*").unwrap().content();