Compare commits
No commits in common. "setup" and "main" have entirely different histories.
4 changed files with 0 additions and 2156 deletions
2120
koucha/Cargo.lock
generated
2120
koucha/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,3 @@ version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = "0.8.8"
|
|
||||||
reqwest = "0.13.1"
|
|
||||||
rss = "2.0.12"
|
|
||||||
tokio = { version = "1.49.0", features = ["full"] }
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
use std::error::Error;
|
|
||||||
use reqwest::Client;
|
|
||||||
use koucha::fetch_channel;
|
|
||||||
|
|
||||||
#[tokio::main]
|
|
||||||
async fn main() -> Result<(), Box<dyn Error>> {
|
|
||||||
let client = Client::new();
|
|
||||||
let _channel = fetch_channel(&client, "https://lorem-rss.herokuapp.com/feed?unit=year").await?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
use std::error::Error;
|
|
||||||
use reqwest::{
|
|
||||||
IntoUrl,
|
|
||||||
Client,
|
|
||||||
};
|
|
||||||
use rss::Channel as RawChannel;
|
|
||||||
|
|
||||||
pub struct Channel {
|
|
||||||
pub channel: rss::Channel,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn fetch_channel<T: IntoUrl>(
|
|
||||||
client: &Client, url: T) -> Result<Channel, Box<dyn Error>> {
|
|
||||||
let content = client.get(url)
|
|
||||||
.send().await?
|
|
||||||
.bytes().await?;
|
|
||||||
|
|
||||||
let raw_channel = RawChannel::read_from(&content[..])?;
|
|
||||||
println!("{}", raw_channel.title);
|
|
||||||
Ok(Channel { channel: raw_channel })
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue