fix: update for new dependencies
This commit is contained in:
parent
d2d95770a3
commit
61a295d08b
|
@ -1,3 +1,5 @@
|
||||||
|
use scraper::selector::ToCss;
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
@ -17,8 +19,7 @@ pub enum Error {
|
||||||
|
|
||||||
impl Error {
|
impl Error {
|
||||||
pub fn missing_element(select: &scraper::Selector) -> Self {
|
pub fn missing_element(select: &scraper::Selector) -> Self {
|
||||||
use cssparser::ToCss;
|
let css = select.to_css_string();
|
||||||
let css = select.selectors.iter().map(ToCss::to_css_string).collect::<Vec<_>>().join(" ");
|
|
||||||
Error::MissingElement(css)
|
Error::MissingElement(css)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,9 @@ fn parse_formed(html: &Html) -> Result<DateTime<Utc>> {
|
||||||
.ok_or_else(|| Error::invalid_content("comma-separated strftime call", Some(&script)))?;
|
.ok_or_else(|| Error::invalid_content("comma-separated strftime call", Some(&script)))?;
|
||||||
let timestamp: i64 = timestamp.parse().map_err(Error::InvalidNumber)?;
|
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)
|
Ok(utc)
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,9 @@ fn parse_formed(html: ElementRef) -> Result<DateTime<Utc>> {
|
||||||
.ok_or_else(|| Error::invalid_content("comma-separated strftime call", Some(&script)))?;
|
.ok_or_else(|| Error::invalid_content("comma-separated strftime call", Some(&script)))?;
|
||||||
let timestamp: i64 = timestamp.parse().map_err(Error::InvalidNumber)?;
|
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)
|
Ok(utc)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue