feedparser-rs
High-performance RSS/Atom/JSON Feed parser written in Rust.
This is the core parsing library that powers the Python and Node.js bindings.
Features
- Multi-format: RSS 0.9x/1.0/2.0, Atom 0.3/1.0, JSON Feed 1.0/1.1
- Tolerant: Bozo flag for graceful handling of malformed feeds
- Fast: Native Rust performance
- Safe: No unsafe code, comprehensive error handling
- HTTP support: Fetch feeds from URLs with compression and conditional GET
- Podcast support: iTunes and Podcast 2.0 namespace extensions
- Well-tested: Extensive test coverage with real-world feed fixtures
Installation
[]
= "0.1"
Quick Start
use parse;
let xml = r#"
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>My Blog</title>
<item>
<title>Hello World</title>
<link>https://example.com/1</link>
</item>
</channel>
</rss>
"#;
let feed = parse?;
assert_eq!;
assert_eq!;
# Ok::
HTTP Fetching
Fetch feeds directly from URLs with automatic compression handling:
use parse_url;
let feed = parse_url?;
println!;
println!;
// Subsequent fetch with caching (uses ETag/Last-Modified)
let feed2 = parse_url?;
if feed2.status == Some
# Ok::
To disable HTTP support and reduce dependencies:
[]
= { = "0.1", = false }
Platform Bindings
- Node.js:
feedparser-rson npm - Python:
feedparser-rson PyPI (coming soon)
Performance
Rust implementation provides significant performance improvements over interpreted alternatives.
See benchmarks/ for benchmark code and methodology.
API Documentation
For full API documentation, see docs.rs/feedparser-rs.
Error Handling
The library uses a "bozo" flag (like feedparser) to indicate parsing errors while still returning partial results:
use parse;
let malformed = b"<rss><channel><title>Broken</title></rss>";
let feed = parse?;
assert!;
assert!;
// Still can access parsed data
assert_eq!;
# Ok::
Parser Limits
To prevent resource exhaustion, the parser enforces limits:
use ;
let limits = ParserLimits ;
let feed = parse_with_limits?;
# Ok::
License
MIT OR Apache-2.0