https://github.com/ravencentric/nzb-rs
A spec compliant parser for NZB files
https://github.com/ravencentric/nzb-rs
nzb parser usenet
Last synced: over 1 year ago
JSON representation
A spec compliant parser for NZB files
- Host: GitHub
- URL: https://github.com/ravencentric/nzb-rs
- Owner: Ravencentric
- License: apache-2.0
- Created: 2025-01-14T14:15:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-10T11:57:13.000Z (over 1 year ago)
- Last Synced: 2025-03-10T12:51:00.472Z (over 1 year ago)
- Topics: nzb, parser, usenet
- Language: Rust
- Homepage: https://crates.io/crates/nzb-rs
- Size: 132 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
nzb-rs
========
[](https://github.com/Ravencentric/nzb-rs/actions/workflows/tests.yml)
[](https://crates.io/crates/nzb-rs)
[](https://docs.rs/nzb-rs)

`nzb-rs` is a [spec](https://sabnzbd.org/wiki/extra/nzb-spec) compliant parser for [NZB](https://en.wikipedia.org/wiki/NZB) files.
## Installation
`nzb-rs` is available on [crates.io](https://crates.io/crates/nzb-rs), so you can simply use [cargo](https://github.com/rust-lang/cargo) to install it.
```console
cargo add nzb-rs
```
Optional features:
- `serde`: Enables serialization and deserialization via [serde](https://crates.io/crates/serde).
## Example
```rust
use nzb_rs::{Nzb, ParseNzbError};
fn main() -> Result<(), ParseNzbError> {
let xml = r#"
alt.binaries.boneless
9cacde4c986547369becbf97003fb2c5-9483514693959@example
70a3a038ce324e618e2751e063d6a036-7285710986748@example
"#;
let nzb = Nzb::parse(xml)?;
println!("{:#?}", nzb);
assert_eq!(nzb.file().name(), Some("Big Buck Bunny - S01E01.mkv"));
Ok(())
}
```
## Safety
- This library must not panic. Any panic should be considered a bug and reported.
- This library uses [`roxmltree`](https://crates.io/crates/roxmltree) for parsing the NZB. `roxmltree` is written entirely in safe Rust, so by Rust's guarantees the worst that a malicious NZB can do is to cause a panic.
## License
Licensed under either of
* Apache License, Version 2.0
([LICENSE-APACHE](https://github.com/Ravencentric/nzb-rs/blob/main/LICENSE-APACHE) or )
* MIT license
([LICENSE-MIT](https://github.com/Ravencentric/nzb-rs/blob/main/LICENSE-MIT) or )
at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.