This commit is contained in:
2022-11-17 19:05:27 +01:00
commit 571be93ce1
4 changed files with 1257 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
use std::error::Error;
use rss::Channel;
async fn example_feed() -> Result<Channel, Box<dyn Error>> {
let content = reqwest::get("https://www.heise.de/rss/heise.rdf")
.await?
.bytes()
.await?;
println!("{}", String::from("reading done"));
let channel = Channel::read_from(&content[..])?;
Ok(channel)
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let channel: Channel = example_feed().await?;
println!("{:?}", channel);
for item in channel.items {
println!("{}", item.content.unwrap());
}
println!("{}", String::from("test"));
Ok(())
}