diff --git a/src/lib.rs b/src/lib.rs index ca157c4..f918b52 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ use std::fs::File; -use atom_syndication::{Entry, Link}; +use atom_syndication::Link; mod errors; mod feed; @@ -16,7 +16,7 @@ pub fn run(subscriptions: &str, history: &str, site: &str) -> Result<()> { println!("Channel: {}", channel_name); let feed_url = feed::get_feed_url(site, &channel_name)?; for entry in feed::get_feed(feed_url)?.entries() { - if let Some(link) = get_link(entry) { + if let Some(link) = entry.links().get(0).cloned() { if !is_already_downloaded(&link, history)? { println!("Downloading {}: {}", &channel_name, entry.title().as_str()); download_audio(&link)?; @@ -28,10 +28,6 @@ pub fn run(subscriptions: &str, history: &str, site: &str) -> Result<()> { Ok(()) } -fn get_link(item: &Entry) -> Option { - item.links().get(0).cloned() -} - // read list of rss feed URLs from file 'feeds.txt' fn lines_from(file_name: &str) -> Result>> { use std::io::{BufRead, BufReader};