I'm writing some code to parse RSS feeds but I have trouble with the Abstruse Goose RSS feed.
If you look in that feed, dates are encoded as Mon, 06 Aug 2018 00:00:00 UTC
. To me, it looks like RFC 2822.
I tried to parse it using chrono's DateTime::parse_from_rfc2822
, but I get ParseError(NotEnough)
.
let pub_date = entry.pub_date().unwrap().to_owned();
return rfc822_sanitizer::parse_from_rfc2822_with_fallback(&pub_date)
.unwrap_or_else(|e| {
panic!(
"pub_date for item {:?} (value is {:?}) can't be parsed due to error {:?}",
&entry, pub_date, e
)
})
.naive_utc();
Is there something I'm doing wrong? Do I have to hack it some way?
I use rfc822_sanitizer which does a good job at fixing bad writing errors (most of the time). I don't think it impacts the parsing ... but who knows?