init
commit
571be93ce1
|
@ -0,0 +1 @@
|
|||
/target
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "rss-reader"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
reqwest = { version = "0.11", features = ["json"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
rss = { version = "2.0.1" }
|
|
@ -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(())
|
||||
}
|
Loading…
Reference in New Issue