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,15 +122,9 @@ 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()
.lines()
.nth(2)
.unwrap()
.trim()
.to_string();
let date = elem let date = elem
.css_once("*") .css_once("*")
.unwrap() .unwrap()
@ -140,6 +134,16 @@ pub fn search_crate(crate_name: String) -> Option<CrateInfo> {
.unwrap() .unwrap()
.trim() .trim()
.to_string(); .to_string();
(version, date)
}
None => {
let binding = elem.css_once("*").unwrap().content();
let mut lines = binding.lines();
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();