Crates.io | future_rss |
lib.rs | future_rss |
version | 1.0.2 |
source | src |
created_at | 2020-05-28 13:07:49.18058 |
updated_at | 2020-06-06 13:24:54.411128 |
description | RSS Parser By Future |
homepage | |
repository | https://github.com/MeteorGX/future_rss |
max_upload_size | |
id | 247024 |
size | 19,967 |
Use Rust to Serialize the Rss structure.
tokio = { version ="*", features = [ "macros","rt-core" ] }
future_rss = "*"
use future_rss::*;
#[tokio::main]
async fn main()->Result<(),Box<dyn std::error::Error>> {
let address = "https://www.zhihu.com/rss";
let mut parser = RssParser::from_url(address,"utf8").await?;
parser.author_tag = String::from("dc:creator");
let rss = parser.parse_vec().await?;
println!("{:?}",rss);
Ok(())
}
use future_rss::RssParser;
#[tokio::main]
async fn main()->Result<(),Box<dyn std::error::Error>> {
let address = "https://www.zhihu.com/rss";
let mut parser = RssParser::from_url(address,"utf8").await?;
parser.author_tag = String::from("dc:creator");
assert!(parser.parse_json().await.is_ok());
Ok(())
}
use future_rss::RssParser;
#[tokio::main]
async fn main()->Result<(),Box<dyn std::error::Error>> {
let address = "https://www.zhihu.com/rss";
let mut parser = RssParser::from_url(address,"utf8").await?;
parser.author_tag = String::from("dc:creator");
assert!(parser.parse_json().await.is_ok());
Ok(())
}
use future_rss::RssParser;
#[tokio::main]
async 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()).await?;
parser.set_xml(xml);
assert!(parser.parse_vec().await.is_ok());
Ok(())
}