rust-syndication / rss

Library for serializing the RSS web content syndication format
https://crates.io/crates/rss
Apache License 2.0
419 stars 52 forks source link

RSS can't parse valid feed #75

Closed Riduidel closed 5 years ago

Riduidel commented 5 years ago

RSS can't parse feed https://stackoverflow.com/feeds/question/51744103 with error

INFO [rrss2imap::feed] Reading feed from https://stackoverflow.com/feeds/question/51744103
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidStartTag', src\libcore\result.rs:1009:5
stack backtrace:
   0: std::sys::windows::backtrace::set_frames
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\sys\windows\backtrace\mod.rs:104
   1: std::sys::windows::backtrace::set_frames
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\sys\windows\backtrace\mod.rs:104
   2: std::sys::windows::backtrace::set_frames
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\sys\windows\backtrace\mod.rs:104
   3: std::sys_common::backtrace::print
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\sys_common\backtrace.rs:59
   4: std::sys_common::backtrace::print
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\sys_common\backtrace.rs:59
   5: std::panicking::default_hook
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\panicking.rs:227
   6: std::panicking::rust_panic_with_hook
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\panicking.rs:491
   7: std::panicking::continue_panic_fmt
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\panicking.rs:398
   8: std::panicking::rust_begin_panic
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\panicking.rs:325
   9: core::panicking::panic_fmt
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libcore\panicking.rs:95
  10: core::result::unwrap_failed<rss::error::Error>
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\macros.rs:26
  11: core::result::Result<rss::channel::Channel, rss::error::Error>::unwrap<rss::channel::Channel,rss::error::Error>
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\result.rs:808
  12: rrss2imap::feed::Feed::read
             at .\src\feed.rs:71
  13: rrss2imap::store::{{impl}}::run::{{closure}}

Please note that W3C validator marks the feed as valid ATOM : https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fstackoverflow.com%2Ffeeds%2Fquestion%2F51744103

Which led me to think that ATOM support may not yet be on par for reading.

Code responsible for reading is a simple

    let feed = Channel::from_url(&self.url).unwrap();
Riduidel commented 5 years ago

Well, seems like I didn't read documentation enough, as it seems like RSS doesn't yet support any ATOM reading.

frewsxcv commented 5 years ago

https://github.com/rust-syndication/atom

Riduidel commented 5 years ago

So you confirm I'll have to use both crates to parse both formats. There is no unifying crate ?

frewsxcv commented 5 years ago

@Riduidel https://github.com/tomshen/rust-syndication might be what you're looking for

Riduidel commented 5 years ago

Indeed, as I'm interested specifically into reading RSS/ATOM feeds, that's exactly what I was searching for. Thanks !