10
goutubedl.go
10
goutubedl.go
@ -206,6 +206,7 @@ type Options struct {
|
|||||||
PlaylistEnd uint // --playlist-end
|
PlaylistEnd uint // --playlist-end
|
||||||
DownloadThumbnail bool
|
DownloadThumbnail bool
|
||||||
DownloadSubtitles bool
|
DownloadSubtitles bool
|
||||||
|
ProxyUrl string // --proxy URL http://host:port or socks5://host:port
|
||||||
DebugLog Printer
|
DebugLog Printer
|
||||||
StderrFn func(cmd *exec.Cmd) io.Writer // if not nil, function to get Writer for stderr
|
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)
|
HTTPClient *http.Client // Client for download thumbnail and subtitles (nil use http.DefaultClient)
|
||||||
@ -258,6 +259,11 @@ func infoFromURL(ctx context.Context, rawURL string, options Options) (info Info
|
|||||||
"--batch-file", "-",
|
"--batch-file", "-",
|
||||||
"-J",
|
"-J",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if options.ProxyUrl != "" {
|
||||||
|
cmd.Args = append(cmd.Args, "--proxy", options.ProxyUrl)
|
||||||
|
}
|
||||||
|
|
||||||
if options.Type == TypePlaylist {
|
if options.Type == TypePlaylist {
|
||||||
cmd.Args = append(cmd.Args, "--yes-playlist")
|
cmd.Args = append(cmd.Args, "--yes-playlist")
|
||||||
|
|
||||||
@ -455,6 +461,10 @@ func (result Result) Download(ctx context.Context, filter string) (*DownloadResu
|
|||||||
cmd.Args = append(cmd.Args, "-f", filter)
|
cmd.Args = append(cmd.Args, "-f", filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if result.Options.ProxyUrl != "" {
|
||||||
|
cmd.Args = append(cmd.Args, "--proxy", result.Options.ProxyUrl)
|
||||||
|
}
|
||||||
|
|
||||||
cmd.Dir = tempPath
|
cmd.Dir = tempPath
|
||||||
var w io.WriteCloser
|
var w io.WriteCloser
|
||||||
dr.reader, w = io.Pipe()
|
dr.reader, w = io.Pipe()
|
||||||
|
Reference in New Issue
Block a user