22 lines
581 B
Rust
22 lines
581 B
Rust
|
use crate::prelude::*;
|
||
|
|
||
|
use atom_syndication::Link;
|
||
|
|
||
|
pub fn download_audio(link: &Link) -> Result<()> {
|
||
|
use std::process::Command;
|
||
|
|
||
|
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(())
|
||
|
}
|