Add force IPV4 support

This commit is contained in:
Gamers_indo1223
2024-07-07 12:20:23 +00:00
parent 3eb676f2fd
commit 0846732ece

View File

@ -225,6 +225,7 @@ type Options struct {
DownloadSubtitles bool DownloadSubtitles bool
DownloadSections string // --download-sections DownloadSections string // --download-sections
ProxyUrl string // --proxy URL http://host:port or socks5://host:port ProxyUrl string // --proxy URL http://host:port or socks5://host:port
UseIPV4 bool
CookiesFromBrowser string // --cookies-from-browser BROWSER[:FOLDER] CookiesFromBrowser string // --cookies-from-browser BROWSER[:FOLDER]
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
@ -321,6 +322,10 @@ func infoFromURL(
cmd.Args = append(cmd.Args, "--proxy", options.ProxyUrl) cmd.Args = append(cmd.Args, "--proxy", options.ProxyUrl)
} }
if options.UseIPV4 {
cmd.Args = append(cmd.Args, "-4")
}
if options.Downloader != "" { if options.Downloader != "" {
cmd.Args = append(cmd.Args, "--downloader", options.Downloader) cmd.Args = append(cmd.Args, "--downloader", options.Downloader)
} }