diff options
Diffstat (limited to 'yt')
-rw-r--r-- | yt/manager.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/yt/manager.go b/yt/manager.go index 190387f..c0cf6cb 100644 --- a/yt/manager.go +++ b/yt/manager.go @@ -2,16 +2,12 @@ package yt import ( "fmt" - "io" "os/exec" ) -func RunYtDlpProcess(link string, output string) string { +func RunYtDlpProcess(link string, output string) { output_template := fmt.Sprintf("%s/%%(title)s.%%(ext)s", output) - cmd := exec.Command("yt-dlp", link, "-o", output_template) - cmdOut, _ := cmd.StdoutPipe() - cmd.Start() - cmd.Wait() - cmdOutBytes, _ := io.ReadAll(cmdOut) - return string(cmdOutBytes) + downloaded_txt := fmt.Sprintf("%s/downloaded.txt", output) + cmd := exec.Command("yt-dlp", link, "-o", output_template, "--download-archive", downloaded_txt) + cmd.Run() } |