Merge pull request #179 from j1cs/master
new feature: cookies from browser option
This commit is contained in:
10
goutubedl.go
10
goutubedl.go
@ -225,6 +225,7 @@ type Options struct {
|
||||
DownloadSubtitles bool
|
||||
DownloadSections string // --download-sections
|
||||
ProxyUrl string // --proxy URL http://host:port or socks5://host:port
|
||||
CookiesFromBrowser string // --cookies-from-browser BROWSER[:FOLDER]
|
||||
DebugLog Printer
|
||||
StderrFn func(cmd *exec.Cmd) io.Writer // if not nil, function to get Writer for stderr
|
||||
HTTPClient *http.Client // Client for download thumbnail and subtitles (nil use http.DefaultClient)
|
||||
@ -319,6 +320,11 @@ func infoFromURL(
|
||||
if options.Downloader != "" {
|
||||
cmd.Args = append(cmd.Args, "--downloader", options.Downloader)
|
||||
}
|
||||
|
||||
if options.CookiesFromBrowser != "" {
|
||||
cmd.Args = append(cmd.Args, "--cookies-from-browser", options.CookiesFromBrowser)
|
||||
}
|
||||
|
||||
switch options.Type {
|
||||
case TypePlaylist, TypeChannel:
|
||||
cmd.Args = append(cmd.Args, "--yes-playlist")
|
||||
@ -610,6 +616,10 @@ func (result Result) DownloadWithOptions(
|
||||
cmd.Args = append(cmd.Args, "--download-sections", result.Options.DownloadSections)
|
||||
}
|
||||
|
||||
if result.Options.CookiesFromBrowser != "" {
|
||||
cmd.Args = append(cmd.Args, "--cookies-from-browser", result.Options.CookiesFromBrowser)
|
||||
}
|
||||
|
||||
if result.Options.MergeOutputFormat != "" {
|
||||
cmd.Args = append(cmd.Args,
|
||||
"--merge-output-format", result.Options.MergeOutputFormat,
|
||||
|
Reference in New Issue
Block a user