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
|
throttle = 1 # throttle yt request
|
||||||
range = "1:5:1" # [START][:STOP][:STEP]
|
range = "1:5:1" # [START][:STOP][:STEP]
|
||||||
after_date = "20250326" # not in use
|
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
|
opml_file = "./opml.xml" # the opml file to use
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Provider struct {
|
type Provider struct {
|
||||||
Url string
|
Url string
|
||||||
Throttle int
|
Throttle int
|
||||||
Range string
|
Range string
|
||||||
After_date string
|
After_date string
|
||||||
Cmd string
|
Cmd string
|
||||||
Cookies string
|
Cookies bool
|
||||||
Opml_file string
|
Cookies_file string
|
||||||
|
Opml_file string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
|
||||||
|
|
@ -36,17 +36,7 @@ func Get(d Download, p config.Provider) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var simulate string
|
args := []string{
|
||||||
if d.DryRun == true {
|
|
||||||
simulate = "--simulate"
|
|
||||||
log.Printf("/!\\ DRY RUN ENABLED /!\\")
|
|
||||||
} else {
|
|
||||||
simulate = "--no-simulate"
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := exec.Command(p.Cmd,
|
|
||||||
fullUrl.String(),
|
|
||||||
simulate,
|
|
||||||
"--no-progress",
|
"--no-progress",
|
||||||
"--sleep-interval", strconv.Itoa(p.Throttle),
|
"--sleep-interval", strconv.Itoa(p.Throttle),
|
||||||
"--sleep-subtitles", 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,
|
"--playlist-items", p.Range,
|
||||||
"--restrict-filenames",
|
"--restrict-filenames",
|
||||||
"--embed-metadata",
|
"--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()
|
stdout, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue