From 1aa4e66c7ef71df46a04d624d43f56416d05a091 Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Mon, 14 Apr 2025 13:06:07 +0200 Subject: [PATCH] feat: support configuring the bgutil server --- Containerfile | 1 + internal/config/config.go | 1 + internal/dl/dl.go | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/Containerfile b/Containerfile index 1155cbf..8971f08 100644 --- a/Containerfile +++ b/Containerfile @@ -46,6 +46,7 @@ COPY <<-EOT /data/config.toml after_date = "" cookies_file = "" po_token = "" + bgutil_server = "http://bgutil:4416" EOT WORKDIR /app diff --git a/internal/config/config.go b/internal/config/config.go index 9b271b7..4d87948 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -19,6 +19,7 @@ type Provider struct { Output_path_template string Po_token string Verbose bool + Bgutil_server string } type Config struct { diff --git a/internal/dl/dl.go b/internal/dl/dl.go index cd21b4a..7588723 100644 --- a/internal/dl/dl.go +++ b/internal/dl/dl.go @@ -24,6 +24,11 @@ type Download struct { } 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") 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)) } + 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") if p.Quality != "" { args = append(args, p.Quality)