feat: control use of cookies_file
All checks were successful
build / build (push) Successful in 1m49s
All checks were successful
build / build (push) Successful in 1m49s
This commit is contained in:
parent
70fa49e16a
commit
7535cd1a1b
|
|
@ -15,7 +15,8 @@ url = "https://www.youtube.com" # full yt url
|
|||
throttle = 1 # throttle yt request
|
||||
range = "1:5:1" # [START][:STOP][:STEP]
|
||||
after_date = "20250326" # not in use
|
||||
cookies = "./cookies.txt" # pass user cookies to yt
|
||||
cookies = false # control use of cookies file
|
||||
cookies_file = "./cookies.txt" # pass user cookies to yt
|
||||
opml_file = "./opml.xml" # the opml file to use
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@ import (
|
|||
)
|
||||
|
||||
type Provider struct {
|
||||
Url string
|
||||
Throttle int
|
||||
Range string
|
||||
After_date string
|
||||
Cmd string
|
||||
Cookies string
|
||||
Opml_file string
|
||||
Url string
|
||||
Throttle int
|
||||
Range string
|
||||
After_date string
|
||||
Cmd string
|
||||
Cookies bool
|
||||
Cookies_file string
|
||||
Opml_file string
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
|
|
|||
|
|
@ -36,17 +36,7 @@ func Get(d Download, p config.Provider) {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
var simulate string
|
||||
if d.DryRun == true {
|
||||
simulate = "--simulate"
|
||||
log.Printf("/!\\ DRY RUN ENABLED /!\\")
|
||||
} else {
|
||||
simulate = "--no-simulate"
|
||||
}
|
||||
|
||||
cmd := exec.Command(p.Cmd,
|
||||
fullUrl.String(),
|
||||
simulate,
|
||||
args := []string{
|
||||
"--no-progress",
|
||||
"--sleep-interval", strconv.Itoa(p.Throttle),
|
||||
"--sleep-subtitles", strconv.Itoa(p.Throttle),
|
||||
|
|
@ -62,8 +52,24 @@ func Get(d Download, p config.Provider) {
|
|||
"--playlist-items", p.Range,
|
||||
"--restrict-filenames",
|
||||
"--embed-metadata",
|
||||
"--cookies", p.Cookies,
|
||||
)
|
||||
}
|
||||
|
||||
if d.DryRun == true {
|
||||
args = append(args, "--simulate")
|
||||
log.Printf("/!\\ DRY RUN ENABLED /!\\")
|
||||
} else {
|
||||
args = append(args, "--no-simulate")
|
||||
}
|
||||
|
||||
if p.Cookies == true {
|
||||
args = append(args, "--cookies")
|
||||
args = append(args, p.Cookies_file)
|
||||
} else {
|
||||
args = append(args, "--no-cookies")
|
||||
}
|
||||
|
||||
args = append(args, fullUrl.String())
|
||||
cmd := exec.Command(p.Cmd, args...)
|
||||
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue