1package yt
2
3import (
4 "fmt"
5 "io"
6 "os/exec"
7)
8
9func RunYtDlpProcess(link string, output string) string {
10 output_template := fmt.Sprintf("%s/%%(title)s.%%(ext)s", output)
11 cmd := exec.Command("yt-dlp", link, "-o", output_template)
12 cmdOut, _ := cmd.StdoutPipe()
13 cmd.Start()
14 cmd.Wait()
15 cmdOutBytes, _ := io.ReadAll(cmdOut)
16 return string(cmdOutBytes)
17}