use youtube-dlc instead

This commit is contained in:
Niko Storni 2020-11-10 18:18:07 +01:00
parent 881d86799b
commit 06c43c3f71
2 changed files with 5 additions and 5 deletions

View file

@ -268,7 +268,7 @@ func run(use string, args []string, stopChan stop.Chan, pool *ip_manager.IPPool)
} }
argsForCommand := append(args, "--source-address", sourceAddress) argsForCommand := append(args, "--source-address", sourceAddress)
argsForCommand = append(argsForCommand, useragent...) argsForCommand = append(argsForCommand, useragent...)
cmd := exec.Command("youtube-dl", argsForCommand...) cmd := exec.Command("youtube-dlc", argsForCommand...)
res, err := runCmd(cmd, stopChan) res, err := runCmd(cmd, stopChan)
pool.ReleaseIP(sourceAddress) pool.ReleaseIP(sourceAddress)
@ -299,7 +299,7 @@ func nextUA(current []string) []string {
} }
func runCmd(cmd *exec.Cmd, stopChan stop.Chan) ([]string, error) { func runCmd(cmd *exec.Cmd, stopChan stop.Chan) ([]string, error) {
logrus.Infof("running youtube-dl cmd: %s", strings.Join(cmd.Args, " ")) logrus.Infof("running youtube-dlc cmd: %s", strings.Join(cmd.Args, " "))
var err error var err error
stderr, err := cmd.StderrPipe() stderr, err := cmd.StderrPipe()
if err != nil { if err != nil {
@ -335,7 +335,7 @@ func runCmd(cmd *exec.Cmd, stopChan stop.Chan) ([]string, error) {
return nil, errors.Err("interrupted by user") return nil, errors.Err("interrupted by user")
case err := <-done: case err := <-done:
if err != nil { if err != nil {
return nil, errors.Prefix("youtube-dl "+strings.Join(cmd.Args, " ")+" ["+string(errorLog)+"]", err) return nil, errors.Prefix("youtube-dlc "+strings.Join(cmd.Args, " ")+" ["+string(errorLog)+"]", err)
} }
return strings.Split(strings.Replace(string(outLog), "\r\n", "\n", -1), "\n"), nil return strings.Split(strings.Replace(string(outLog), "\r\n", "\n", -1), "\n"), nil
} }

View file

@ -277,8 +277,8 @@ func (v *YoutubeVideo) download() error {
quality := qualities[i] quality := qualities[i]
argsWithFilters := append(ytdlArgs, "-fbestvideo[ext=mp4][height<="+quality+"]+bestaudio[ext!=webm]") argsWithFilters := append(ytdlArgs, "-fbestvideo[ext=mp4][height<="+quality+"]+bestaudio[ext!=webm]")
argsWithFilters = append(argsWithFilters, userAgent...) argsWithFilters = append(argsWithFilters, userAgent...)
cmd := exec.Command("youtube-dl", argsWithFilters...) cmd := exec.Command("youtube-dlc", argsWithFilters...)
log.Printf("Running command youtube-dl %s", strings.Join(argsWithFilters, " ")) log.Printf("Running command youtube-dlc %s", strings.Join(argsWithFilters, " "))
stderr, err := cmd.StderrPipe() stderr, err := cmd.StderrPipe()
if err != nil { if err != nil {