Fix NEW versions Again AAAA
parent
beead99db8
commit
692b719b90
|
@ -122,24 +122,28 @@ 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 date = elem
|
||||
.css_once("*")
|
||||
.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()
|
||||
.content()
|
||||
.lines()
|
||||
.nth(2)
|
||||
.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();
|
||||
|
|
Loading…
Reference in New Issue