Compare commits

...

2 Commits

Author SHA1 Message Date
Anna a55d304b57
chore: bump version to 1.1.0 2024-01-24 07:03:14 -05:00
Anna 61a295d08b
fix: update for new dependencies 2024-01-24 07:02:46 -05:00
4 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "lodestone-parser"
version = "1.0.0"
version = "1.1.0"
authors = ["Anna <git@anna.lgbt>"]
edition = "2021"

View File

@ -1,3 +1,5 @@
use scraper::selector::ToCss;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
@ -17,8 +19,7 @@ pub enum Error {
impl Error {
pub fn missing_element(select: &scraper::Selector) -> Self {
use cssparser::ToCss;
let css = select.selectors.iter().map(ToCss::to_css_string).collect::<Vec<_>>().join(" ");
let css = select.to_css_string();
Error::MissingElement(css)
}

View File

@ -133,7 +133,9 @@ fn parse_formed(html: &Html) -> Result<DateTime<Utc>> {
.ok_or_else(|| Error::invalid_content("comma-separated strftime call", Some(&script)))?;
let timestamp: i64 = timestamp.parse().map_err(Error::InvalidNumber)?;
let utc = Local.timestamp(timestamp, 0).with_timezone(&Utc);
let utc = Local.timestamp_opt(timestamp, 0)
.unwrap()
.with_timezone(&Utc);
Ok(utc)
}

View File

@ -144,7 +144,9 @@ fn parse_formed(html: ElementRef) -> Result<DateTime<Utc>> {
.ok_or_else(|| Error::invalid_content("comma-separated strftime call", Some(&script)))?;
let timestamp: i64 = timestamp.parse().map_err(Error::InvalidNumber)?;
let utc = Local.timestamp(timestamp, 0).with_timezone(&Utc);
let utc = Local.timestamp_opt(timestamp, 0)
.unwrap()
.with_timezone(&Utc);
Ok(utc)
}