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() {
None
} else if elem.css_once(".new").is_some() {
let version = elem
.css_once("a")
.unwrap()
.content()
.lines()
.nth(2)
.unwrap()
.trim()
.to_string();
let (version, date) = match elem.css_once("a") {
Some(a) => {
let version = a.content().lines().nth(2).unwrap().trim().to_string();
let date = elem
.css_once("*")
.unwrap()
@ -140,6 +134,16 @@ pub fn search_crate(crate_name: String) -> Option<CrateInfo> {
.unwrap()
.trim()
.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))
} else {
let raw_data = elem.css_once("*").unwrap().content();