ytdl-web/ytdl/stream.go

24 lines
304 B
Go

package ytdl
import (
"io"
"os/exec"
)
func Stream(wr io.Writer, url string, format Format) error {
cmd := exec.Command(
"yt-dlp",
"-o", "-",
"-f", format.FormatID,
"--merge-output-format", "mkv",
url,
)
cmd.Stdout = wr
if err := cmd.Run(); err != nil {
return err
}
return nil
}