From db643947dc2d596ac32e05115c401f2a4d6dfafe Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Mon, 8 Sep 2025 22:54:25 +0200 Subject: [PATCH] fix: stop the extractor-args from overwriting eachother --- internal/dl/dl.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/dl/dl.go b/internal/dl/dl.go index a1c0b76..912028b 100644 --- a/internal/dl/dl.go +++ b/internal/dl/dl.go @@ -11,6 +11,7 @@ import ( "os/exec" "path/filepath" "strconv" + "strings" "sync" "git.meatbag.se/varl/subsyt/internal/config" @@ -98,19 +99,18 @@ func Youtube(d Download, p config.Provider) { args = append(args, "--no-cookies") } + var youtubeArgs []string if p.Po_token != "" { - args = append(args, "--extractor-args") - args = append(args, fmt.Sprintf("youtube:po_token=web.gvs+%s", p.Po_token)) + youtubeArgs = append(youtubeArgs, fmt.Sprintf("po_token=web.gvs+%s", p.Po_token)) } - if p.Bgutil_server != "" { - args = append(args, "--extractor-args") - args = append(args, fmt.Sprintf("youtube:getpot_bgutil_baseurl=%s", p.Bgutil_server)) + youtubeArgs = append(youtubeArgs, fmt.Sprintf("getpot_bgutil_baseurl=%s", p.Bgutil_server)) } - if p.Player_client != "" { - args = append(args, "--extractor-args") - args = append(args, fmt.Sprintf("youtube:player_client=%s", p.Player_client)) + youtubeArgs = append(youtubeArgs, fmt.Sprintf("player_client=%s", p.Player_client)) + } + if len(youtubeArgs) > 0 { + args = append(args, "--extractor-args", fmt.Sprintf("youtube:%s", strings.Join(youtubeArgs, ";"))) } if p.Output_path_template != "" {