aboutsummaryrefslogtreecommitdiff
path: root/yt
diff options
context:
space:
mode:
Diffstat (limited to 'yt')
-rw-r--r--yt/manager.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/yt/manager.go b/yt/manager.go
new file mode 100644
index 0000000..190387f
--- /dev/null
+++ b/yt/manager.go
@@ -0,0 +1,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)
+}