diff --git a/crates/providers/hitta/src/parser.rs b/crates/providers/hitta/src/parser.rs index 545eca8..8047a3c 100644 --- a/crates/providers/hitta/src/parser.rs +++ b/crates/providers/hitta/src/parser.rs @@ -42,7 +42,7 @@ struct Statistics { #[derive(Debug, Deserialize)] struct RawComment { comment: String, - timestamp: u64, + timestamp: Option, } pub fn request_urls(number: &str) -> Vec { @@ -96,13 +96,13 @@ pub fn parse(body: &str) -> Result { .into_iter() .filter(|raw| !raw.comment.trim().is_empty()) .map(|raw| ParsedComment { - timestamp: Some((raw.timestamp / 1000) as i64), + timestamp: raw.timestamp.map(|millis| (millis / 1000) as i64), title: None, message: raw.comment, }) .collect(); - comments.sort_by(|a, b| b.timestamp.cmp(&a.timestamp)); + comments.sort_by_key(|comment| std::cmp::Reverse(comment.timestamp)); return Ok(ParsedEntry { messages: Vec::new(),