Add option to prefer original Language.
This commit is contained in:
@@ -8,28 +8,27 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func YoutubeVideo(url string) error {
|
func YoutubeVideo(url string) error {
|
||||||
conf, _ := config.New()
|
conf, _ := config.New()
|
||||||
|
|
||||||
err := utils.EnsureDirectory(conf.DownloadPath)
|
err := utils.EnsureDirectory(conf.DownloadPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("failed to create download directory!")
|
return errors.New("failed to create download directory!")
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadBinary := "yt-dlp"
|
downloadBinary := "yt-dlp"
|
||||||
|
|
||||||
output := fmt.Sprintf("%s/%%(title)s.%%(ext)s", conf.DownloadPath)
|
output := fmt.Sprintf("%s/%%(title)s.%%(ext)s", conf.DownloadPath)
|
||||||
args := []string{"-S", "filesize~100M", "-o", output, url}
|
args := []string{"-S", "filesize~100M", "-f", "'bv+(ba[format_note*=original]/ba)'", "-o", output, url}
|
||||||
cmd := exec.Command(downloadBinary, args...)
|
cmd := exec.Command(downloadBinary, args...)
|
||||||
|
|
||||||
fmt.Println(cmd.String())
|
fmt.Println(cmd.String())
|
||||||
|
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return errors.New("failed to download video!")
|
return errors.New("failed to download video!")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user