refactor: add some comments
Some checks failed
build / build (push) Has been cancelled

This commit is contained in:
Viktor Varland 2025-09-09 09:32:36 +02:00
parent 22d935609f
commit 94df38f642
No known key found for this signature in database
GPG key ID: 940DFD5EADD1E94A

View file

@ -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, ";")))
}