diff --git a/hammond-data/src/models/new_episode.rs b/hammond-data/src/models/new_episode.rs
index 3eba254..9df4229 100644
--- a/hammond-data/src/models/new_episode.rs
+++ b/hammond-data/src/models/new_episode.rs
@@ -197,9 +197,9 @@ impl NewEpisodeMinimal {
let guid = item.guid().map(|s| s.value().trim().to_owned());
let uri = item.enclosure()
- .map(|s| url_cleaner(s.url()))
+ .map(|s| url_cleaner(s.url().trim()))
// Fallback to Rss.Item.link if enclosure is None.
- .or_else(|| item.link().map(|s| url_cleaner(s)));
+ .or_else(|| item.link().map(|s| url_cleaner(s.trim())));
// If url is still None return an Error as this behaviour is
// compliant with the RSS Spec.
@@ -234,7 +234,13 @@ impl NewEpisodeMinimal {
// TODO: TryInto is stabilizing in rustc v1.26!
pub(crate) fn into_new_episode(self, item: &rss::Item) -> NewEpisode {
let length = item.enclosure().and_then(|x| x.length().parse().ok());
- let description = item.description().map(|s| ammonia::clean(s));
+ let description = item.description().map(|s| {
+ ammonia::Builder::new()
+ // Remove `rel` attributes from `` tags
+ .link_rel(None)
+ .clean(chan.description().trim())
+ .to_string();
+ });
NewEpisodeBuilder::default()
.title(self.title)
diff --git a/hammond-data/src/models/new_podcast.rs b/hammond-data/src/models/new_podcast.rs
index a4faa2a..38f31b7 100644
--- a/hammond-data/src/models/new_podcast.rs
+++ b/hammond-data/src/models/new_podcast.rs
@@ -88,16 +88,20 @@ impl NewPodcast {
/// Parses a `rss::Channel` into a `NewPodcast` Struct.
pub(crate) fn new(chan: &rss::Channel, source_id: i32) -> NewPodcast {
let title = chan.title().trim();
+ let link = url_cleaner(chan.link().trim());
- let description = ammonia::clean(chan.description().trim());
- let link = url_cleaner(chan.link());
+ let description = ammonia::Builder::new()
+ // Remove `rel` attributes from `` tags
+ .link_rel(None)
+ .clean(chan.description().trim())
+ .to_string();
// Try to get the itunes img first
let itunes_img = chan.itunes_ext()
- .and_then(|s| s.image())
+ .and_then(|s| s.image().trim())
.map(|s| s.to_owned());
// If itunes is None, try to get the channel.image from the rss spec
- let image_uri = itunes_img.or_else(|| chan.image().map(|s| s.url().to_owned()));
+ let image_uri = itunes_img.or_else(|| chan.image().map(|s| s.url().trim().to_owned()));
NewPodcastBuilder::default()
.title(title)