Crates.io | nzb-rs |
lib.rs | nzb-rs |
version | 0.6.0 |
created_at | 2025-01-19 13:59:12.235072+00 |
updated_at | 2025-08-22 16:48:37.854703+00 |
description | A spec compliant parser for NZB files |
homepage | |
repository | https://github.com/Ravencentric/nzb-rs |
max_upload_size | |
id | 1522839 |
size | 157,802 |
nzb-rs
is a spec compliant parser for NZB files.
nzb-rs
is available on crates.io, so you can simply use cargo to install it.
cargo add nzb-rs
Optional features:
serde
: Enables serialization and deserialization via serde.use nzb_rs::{Nzb, ParseNzbError};
fn main() -> Result<(), ParseNzbError> {
let xml = r#"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.1//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd">
<nzb
xmlns="http://www.newzbin.com/DTD/2003/nzb">
<file poster="John <nzb@nowhere.example>" date="1706440708" subject="[1/1] - "Big Buck Bunny - S01E01.mkv" yEnc (1/2) 1478616">
<groups>
<group>alt.binaries.boneless</group>
</groups>
<segments>
<segment bytes="739067" number="1">9cacde4c986547369becbf97003fb2c5-9483514693959@example</segment>
<segment bytes="739549" number="2">70a3a038ce324e618e2751e063d6a036-7285710986748@example</segment>
</segments>
</file>
</nzb>
"#;
let nzb = Nzb::parse(xml)?;
println!("{:#?}", nzb);
assert_eq!(nzb.file().name(), Some("Big Buck Bunny - S01E01.mkv"));
Ok(())
}
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.Licensed under either of
at your option.
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.