Crates.io | easy_rss |
lib.rs | easy_rss |
version | 1.0.1 |
source | src |
created_at | 2020-06-17 00:00:41.795198 |
updated_at | 2020-06-17 00:00:41.795198 |
description | RSS Parser |
homepage | |
repository | https://github.com/MeteorGX/easy_rss |
max_upload_size | |
id | 254735 |
size | 19,795 |
Use Rust to Serialize the Rss structure.
easy_rss = "*"
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(())
}
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(())
}
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(())
}
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(())
}