Added Download Audio Only

This commit is contained in:
Gamers_indo1223
2024-07-11 16:13:41 +00:00
parent 0986214517
commit 3abe5ae66a

View File

@ -224,6 +224,7 @@ type Options struct {
DownloadThumbnail bool DownloadThumbnail bool
DownloadSubtitles bool DownloadSubtitles bool
DownloadSections string // --download-sections DownloadSections string // --download-sections
DownloadAudioOnly bool // -x Download audio only from video
ProxyUrl string // --proxy URL http://host:port or socks5://host:port ProxyUrl string // --proxy URL http://host:port or socks5://host:port
UseIPV4 bool // -4 Make all connections via IPv4 UseIPV4 bool // -4 Make all connections via IPv4
CookiesFromBrowser string // --cookies-from-browser BROWSER[:FOLDER] CookiesFromBrowser string // --cookies-from-browser BROWSER[:FOLDER]
@ -638,7 +639,9 @@ func (result Result) DownloadWithOptions(
if result.Options.CookiesFromBrowser != "" { if result.Options.CookiesFromBrowser != "" {
cmd.Args = append(cmd.Args, "--cookies-from-browser", result.Options.CookiesFromBrowser) cmd.Args = append(cmd.Args, "--cookies-from-browser", result.Options.CookiesFromBrowser)
} }
if result.Options.DownloadAudioOnly {
cmd.Args = append(cmd.Args, "-x")
}
if result.Options.MergeOutputFormat != "" { if result.Options.MergeOutputFormat != "" {
cmd.Args = append(cmd.Args, cmd.Args = append(cmd.Args,
"--merge-output-format", result.Options.MergeOutputFormat, "--merge-output-format", result.Options.MergeOutputFormat,