feat: support configuring the bgutil server
All checks were successful
build / build (push) Successful in 1m22s

This commit is contained in:
Viktor Varland 2025-04-14 13:06:07 +02:00
parent 08779a5941
commit 1aa4e66c7e
Signed by: varl
GPG key ID: 7459F0B410115EE8
3 changed files with 12 additions and 0 deletions

View file

@ -46,6 +46,7 @@ COPY <<-EOT /data/config.toml
after_date = "" after_date = ""
cookies_file = "" cookies_file = ""
po_token = "" po_token = ""
bgutil_server = "http://bgutil:4416"
EOT EOT
WORKDIR /app WORKDIR /app

View file

@ -19,6 +19,7 @@ type Provider struct {
Output_path_template string Output_path_template string
Po_token string Po_token string
Verbose bool Verbose bool
Bgutil_server string
} }
type Config struct { type Config struct {

View file

@ -24,6 +24,11 @@ type Download struct {
} }
func Youtube(d Download, p config.Provider) { func Youtube(d Download, p config.Provider) {
if p.Bgutil_server != "" && p.Po_token != "" {
log.Fatal("please only provide bgutil_server OR po_token, not both")
}
archive := filepath.Join(d.OutDir, "archive.txt") archive := filepath.Join(d.OutDir, "archive.txt")
outdir := d.OutDir outdir := d.OutDir
@ -96,6 +101,11 @@ func Youtube(d Download, p config.Provider) {
args = append(args, fmt.Sprintf("youtube:po_token=web.gvs+%s", p.Po_token)) args = append(args, fmt.Sprintf("youtube: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))
}
args = append(args, "--format-sort") args = append(args, "--format-sort")
if p.Quality != "" { if p.Quality != "" {
args = append(args, p.Quality) args = append(args, p.Quality)