konobangu/crates/recorder/src/rss/engine.rs
2024-02-23 22:07:44 +08:00

24 lines
629 B
Rust

use serde::{Deserialize, Serialize};
use crate::models::subscriptions::subscriptions;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RssTorrent {}
#[derive(Debug)]
pub struct RssEngine {}
impl RssEngine {
// pub async fn get_rss_torrents(
// rss_subscription: &subscriptions::ActiveModel,
// ) -> eyre::Result<Vec<RssTorrent>> {
// Ok(())
// }
pub async fn get_torrents(url: &str) -> eyre::Result<rss::Channel> {
let content = reqwest::get(url).await?.bytes().await?;
let channel: rss::Channel = rss::Channel::read_from(&content[..])?;
Ok(channel)
}
}