<p align="center"><img src="docs/assets/hero.svg" width="100%"></p>
[](https://github.com/akitenkrad/rs-feed-parser/actions/workflows/unit_test.yml)
[](https://crates.io/crates/feed-parser)
[](https://docs.rs/feed-parser)
`feed-parser` reads RSS 1.0, RSS 2.0 and Atom documents into a single `Feed` type, so
the code that consumes a feed does not need to know which format the source publishes.
Each format keeps its own parser, and the differences between them — `dc:creator`,
`pubDate` versus `published`, Atom's `<link>` attributes — are normalized on the way in.
Malformed input is returned as a `ParseError` rather than raised as a panic.
## Install
```bash
cargo add feed-parser
```
Requires Rust 1.85 or newer.
## Quick Start
```rust
use feed_parser::parsers::{Feed, rss2};
let rss_data = r#"
<rss version="2.0">
<channel>
<title>RSS Title</title>
<link>http://www.example.com/main.html</link>
<description>This is an example of an RSS feed</description>
<item>
<title>Item 1</title>
<link>http://www.example.com/item1.html</link>
<description>Item 1 description</description>
<pubDate>2024-01-01T23:59:02Z</pubDate>
</item>
</channel>
</rss>
"#;
let feeds: Vec<Feed> = rss2::parse(rss_data).unwrap();
assert_eq!(feeds[0].title, "Item 1");
assert_eq!(feeds[0].link, "http://www.example.com/item1.html");
assert_eq!(feeds[0].description.clone().unwrap(), "Item 1 description");
```
## Documentation
- **[Usage](docs/usage.md)** — the three parsers, the `Feed` type, and how each format's elements are mapped onto it.
- **[Error Handling](docs/errors.md)** — every `ParseError` variant, when each is returned, and how to match on them.
- **[Development](docs/development.md)** — build and test commands, repository layout, the MSRV policy, and the release process.
- **[Changelog](docs/changelog.md)** — release notes and the 1.x to 2.0 migration guide.
## License
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE).