2023-04-14 17:32:20 -04:00
|
|
|
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",
|
2023-04-15 12:38:33 -04:00
|
|
|
"--cookies-from-browser", "firefox",
|
2023-04-14 17:32:20 -04:00
|
|
|
url,
|
|
|
|
)
|
|
|
|
|
|
|
|
cmd.Stdout = wr
|
|
|
|
if err := cmd.Run(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|