From 8341131031d23d930ed12a7d0067c9d3844e41cd Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Wed, 9 Apr 2025 13:10:47 +0200 Subject: [PATCH] feat: po_token and verbose config options --- README.md | 2 ++ internal/config/config.go | 2 ++ internal/dl/dl.go | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 4c0e35e..5f7c3c6 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ range = "1:5:1" # downloads last 5 videos: [START][:STOP after_date = "20250326" # only download videos after date cookies_file = "" # pass user cookies to yt, blank to disable opml_file = "./opml.xml" # the opml file to use +po_token = "" # pass a proof-of-origin token +verbose = true # debug info for provider ``` ## generate opml diff --git a/internal/config/config.go b/internal/config/config.go index 527fb0b..ccfd3e8 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -17,6 +17,8 @@ type Provider struct { Opml_file string Quality string Output_path_template string + Po_token string + Verbose bool } type Config struct { diff --git a/internal/dl/dl.go b/internal/dl/dl.go index cdc9797..07c30d0 100644 --- a/internal/dl/dl.go +++ b/internal/dl/dl.go @@ -2,6 +2,7 @@ package dl import ( "bufio" + "fmt" "io" "log" "net/http" @@ -50,6 +51,7 @@ func Youtube(d Download, p config.Provider) { "--sleep-interval", throttle, "--sleep-subtitles", throttle, "--sleep-requests", throttle, + "--max-sleep-interval", "90", "--format-sort", p.Quality, "--prefer-free-formats", "--write-subs", @@ -75,6 +77,10 @@ func Youtube(d Download, p config.Provider) { args = append(args, "--no-simulate") } + if p.Verbose == true { + args = append(args, "--verbose") + } + if p.Cookies_file != "" { args = append(args, "--cookies") args = append(args, p.Cookies_file) @@ -87,6 +93,11 @@ func Youtube(d Download, p config.Provider) { args = append(args, p.After_date) } + if p.Po_token != "" { + args = append(args, "--extractor-args") + args = append(args, fmt.Sprintf("youtube:po_token=web.gvs+%s", p.Po_token)) + } + args = append(args, channelUrl.String()) cmd := exec.Command(p.Cmd, args...)