From 94df38f64209e9c344765e17f72e0116b713079f Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Tue, 9 Sep 2025 09:32:36 +0200 Subject: [PATCH] refactor: add some comments --- internal/dl/dl.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/dl/dl.go b/internal/dl/dl.go index cd4e46f..eb83f73 100644 --- a/internal/dl/dl.go +++ b/internal/dl/dl.go @@ -55,8 +55,13 @@ func Youtube(d Download, p config.Provider) { args = append(args, "--no-simulate") } + // NOTE: we want to download the metadata for a channel, without + // downloading every video in the channel. This uses + // --playlist-items to download the video indices 0 to 0 with a step + // of 1 ... this results in zero videos being downloaded. + if d.Metadata == true { - log.Println("Downloading metadata") + log.Println("Downloading channel metadata") mArgs := []string{ "--skip-download", "--no-overwrites", @@ -95,8 +100,7 @@ func Youtube(d Download, p config.Provider) { } if p.Cookies_file != "" { - args = append(args, "--cookies") - args = append(args, p.Cookies_file) + args = append(args, "--cookies", p.Cookies_file) } else { args = append(args, "--no-cookies") } @@ -105,6 +109,7 @@ func Youtube(d Download, p config.Provider) { args = append(args, "--extractor-args", fmt.Sprintf("youtubepot-bgutilhttp:base_url=%s", p.Bgutil_server)) } + // NOTE: every unqiue extractor's args needs to be combined into one string var youtubeArgs []string if p.Po_token != "" { youtubeArgs = append(youtubeArgs, fmt.Sprintf("po_token=web.gvs+%s", p.Po_token)) @@ -112,6 +117,7 @@ func Youtube(d Download, p config.Provider) { if 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, ";"))) }