mirror of
https://github.com/narrrl/ytd-rs.git
synced 2026-11-04 08:57:01 +01:00
feat: add convenience methods for extracting audio only
This commit is contained in:
1 parent
f5d2083248
commit
c9872ccfbc
2 files changed
+11
-2
No files matched your search
+10
@@ -150,6 +150,11 @@ impl YtDlp {
|
||||
self.arg_with("--audio-format", format)
|
||||
}
|
||||
|
||||
/// Configures yt-dlp to download only the best audio and extract it to the given format (e.g., "mp3").
|
||||
pub fn extract_audio_only(self, format: impl Into<String>) -> Self {
|
||||
self.best_audio().extract_audio(true).audio_format(format)
|
||||
}
|
||||
|
||||
/// Convenience method for --output template.
|
||||
pub fn output_template(self, template: impl Into<String>) -> Self {
|
||||
self.arg_with("--output", template)
|
||||
@@ -165,6 +170,11 @@ impl YtDlp {
|
||||
self.format("bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best")
|
||||
}
|
||||
|
||||
/// Select the best quality audio only.
|
||||
pub fn best_audio(self) -> Self {
|
||||
self.format("bestaudio/best")
|
||||
}
|
||||
|
||||
/// Path to a cookies file.
|
||||
pub fn cookies(self, path: impl Into<String>) -> Self {
|
||||
self.arg_with("--cookies", path)
|
||||
|
||||
Reference in new issue
Block a user