aboutsummaryrefslogtreecommitdiff
path: root/yt/manager.go
blob: 190387fda161b5691644383a3ed7eba927543da4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package yt

import (
	"fmt"
	"io"
	"os/exec"
)

func RunYtDlpProcess(link string, output string) 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)
}