feat: po_token and verbose config options
All checks were successful
build / build (push) Successful in 1m55s

This commit is contained in:
Viktor Varland 2025-04-09 13:10:47 +02:00
parent 3adf768132
commit 8341131031
Signed by: varl
GPG key ID: 7459F0B410115EE8
3 changed files with 15 additions and 0 deletions

View file

@ -48,6 +48,8 @@ range = "1:5:1" # downloads last 5 videos: [START][:STOP
after_date = "20250326" # only download videos after date after_date = "20250326" # only download videos after date
cookies_file = "" # pass user cookies to yt, blank to disable cookies_file = "" # pass user cookies to yt, blank to disable
opml_file = "./opml.xml" # the opml file to use 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 ## generate opml

View file

@ -17,6 +17,8 @@ type Provider struct {
Opml_file string Opml_file string
Quality string Quality string
Output_path_template string Output_path_template string
Po_token string
Verbose bool
} }
type Config struct { type Config struct {

View file

@ -2,6 +2,7 @@ package dl
import ( import (
"bufio" "bufio"
"fmt"
"io" "io"
"log" "log"
"net/http" "net/http"
@ -50,6 +51,7 @@ func Youtube(d Download, p config.Provider) {
"--sleep-interval", throttle, "--sleep-interval", throttle,
"--sleep-subtitles", throttle, "--sleep-subtitles", throttle,
"--sleep-requests", throttle, "--sleep-requests", throttle,
"--max-sleep-interval", "90",
"--format-sort", p.Quality, "--format-sort", p.Quality,
"--prefer-free-formats", "--prefer-free-formats",
"--write-subs", "--write-subs",
@ -75,6 +77,10 @@ func Youtube(d Download, p config.Provider) {
args = append(args, "--no-simulate") args = append(args, "--no-simulate")
} }
if p.Verbose == true {
args = append(args, "--verbose")
}
if p.Cookies_file != "" { if p.Cookies_file != "" {
args = append(args, "--cookies") args = append(args, "--cookies")
args = append(args, p.Cookies_file) args = append(args, p.Cookies_file)
@ -87,6 +93,11 @@ func Youtube(d Download, p config.Provider) {
args = append(args, p.After_date) 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()) args = append(args, channelUrl.String())
cmd := exec.Command(p.Cmd, args...) cmd := exec.Command(p.Cmd, args...)