use crate::prelude::*; use crate::network::{NetUrl, NetworkEnv}; use atom_syndication::Feed; mod find; pub use find::find; pub fn get(url: &NetUrl, e: &NetworkEnv) -> Result { let content = (e.fetch_as_bytes)(url).context(format!("Fetching feed: {}", url))?; let channel = Feed::read_from(&content[..]).context("Could not parse RSS feed")?; Ok(channel) } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ChannelName(pub String); impl ChannelName { pub fn from(channel_name: &str) -> Self { Self(channel_name.to_string()) } } impl std::fmt::Display for ChannelName { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0.as_str()) } }