Documentation
  • Coverage
  • 38.89%
    14 out of 36 items documented3 out of 14 items with examples
  • Size
  • Source code size: 58.41 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.67 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 9s Average build duration of successful builds.
  • all releases: 1m 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MeteorGX

easy_rss

Use Rust to Serialize the Rss structure.

Usage

easy_rss = "*"

Examples

Parse Xml
use easy_rss::*;

fn main()->Result<(),Box<dyn std::error::Error>> {
    let address = "https://www.zhihu.com/rss";
    let mut parser = RssParser::from_url(address,"utf8")?;
    parser.author_tag = String::from("dc:creator");
    
    let rss = parser.parse_vec()?;
    println!("{:?}",rss);    
    Ok(())
}

Parse Web XMl

use easy_rss::RssParser;

fn main()->Result<(),Box<dyn std::error::Error>> {
    let address = "https://www.zhihu.com/rss";
    let mut parser = RssParser::from_url(address,"utf8")?;
    parser.author_tag = String::from("dc:creator");
    assert!(parser.parse_json().is_ok());
    Ok(())
}

RSS To Json

use easy_rss::RssParser;

fn main()->Result<(),Box<dyn std::error::Error>> {
    let address = "https://www.zhihu.com/rss";
    let mut parser = RssParser::from_url(address,"utf8")?;
    parser.author_tag = String::from("dc:creator");
    assert!(parser.parse_json().is_ok());
    Ok(())
}

Rss Request Builder

use easy_rss::RssParser;

fn main()->Result<(),Box<dyn std::error::Error>> {
    let address = "https://www.zhihu.com/rss";
    let mut parser = RssParser::new();
    parser.author_tag = "dc:creator".into();
    parser.publish_tag = "pubDate".into();
    let xml = parser.request_xml(address.as_str(),charset.as_str())?;
    parser.set_xml(xml);
    assert!(parser.parse_vec().is_ok());
    Ok(())
}

Advanced

Examples