use crate::prelude::*; use atom_syndication::Link; use std::process::Command; pub type FetchDownload = fn(&Link) -> Result<()>; pub fn download(link: &Link) -> Result<()> { let cmd = "yt-dlp"; // println!("{} --extract-audio --audio-format mp3 {}", cmd, &link.href); let output = Command::new(cmd) .arg("--extract-audio") .arg("--audio-format") .arg("mp3") .arg(&link.href) .output()?; if !output.stderr.is_empty() { eprintln!("Error: {}", String::from_utf8(output.stderr)?); println!("{}", String::from_utf8(output.stdout)?); } Ok(()) }