Compare commits
8 Commits
bump-golan
...
bump-golan
Author | SHA1 | Date | |
---|---|---|---|
d3f32f5956 | |||
a623bde37b | |||
90467bcf8a | |||
d47fecba92 | |||
65804d5c0f | |||
95037e2caf | |||
346cfb47a0 | |||
3abe5ae66a |
@ -1,6 +1,6 @@
|
||||
# bump: golang /GOLANG_VERSION=([\d.]+)/ docker:golang|^1
|
||||
# bump: golang link "Release notes" https://golang.org/doc/devel/release.html
|
||||
ARG GOLANG_VERSION=1.22.6
|
||||
ARG GOLANG_VERSION=1.23.1
|
||||
# bump: yt-dlp /YT_DLP=([\d.-]+)/ https://github.com/yt-dlp/yt-dlp.git|/^\d/|sort
|
||||
# bump: yt-dlp link "Release notes" https://github.com/yt-dlp/yt-dlp/releases/tag/$LATEST
|
||||
ARG YT_DLP=2024.08.06
|
||||
|
30
goutubedl.go
30
goutubedl.go
@ -217,15 +217,17 @@ var TypeFromString = map[string]Type{
|
||||
|
||||
// Options for New()
|
||||
type Options struct {
|
||||
Type Type
|
||||
PlaylistStart uint // --playlist-start
|
||||
PlaylistEnd uint // --playlist-end
|
||||
Downloader string // --downloader
|
||||
DownloadThumbnail bool
|
||||
DownloadSubtitles bool
|
||||
DownloadSections string // --download-sections
|
||||
Type Type
|
||||
PlaylistStart uint // --playlist-start
|
||||
PlaylistEnd uint // --playlist-end
|
||||
Downloader string // --downloader
|
||||
DownloadThumbnail bool
|
||||
DownloadSubtitles bool
|
||||
DownloadSections string // --download-sections
|
||||
|
||||
ProxyUrl string // --proxy URL http://host:port or socks5://host:port
|
||||
UseIPV4 bool // -4 Make all connections via IPv4
|
||||
Cookies string // --cookies FILE
|
||||
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
|
||||
@ -330,6 +332,10 @@ func infoFromURL(
|
||||
cmd.Args = append(cmd.Args, "--downloader", options.Downloader)
|
||||
}
|
||||
|
||||
if options.Cookies != "" {
|
||||
cmd.Args = append(cmd.Args, "--cookies", options.Cookies)
|
||||
}
|
||||
|
||||
if options.CookiesFromBrowser != "" {
|
||||
cmd.Args = append(cmd.Args, "--cookies-from-browser", options.CookiesFromBrowser)
|
||||
}
|
||||
@ -522,6 +528,8 @@ func (result Result) Download(ctx context.Context, filter string) (*DownloadResu
|
||||
}
|
||||
|
||||
type DownloadOptions struct {
|
||||
AudioFormats string // --audio-formats Download audio using formats (best, aac, alac, flac, m4a, mp3, opus, vorbis, wav)
|
||||
DownloadAudioOnly bool // -x Download audio only from video
|
||||
// Download format matched by filter (usually a format id or quality designator).
|
||||
// If filter is empty, then youtube-dl will use its default format selector.
|
||||
Filter string
|
||||
@ -623,6 +631,14 @@ func (result Result) DownloadWithOptions(
|
||||
cmd.Args = append(cmd.Args, "--playlist-items", fmt.Sprint(options.PlaylistIndex))
|
||||
}
|
||||
|
||||
if options.DownloadAudioOnly {
|
||||
cmd.Args = append(cmd.Args, "-x")
|
||||
}
|
||||
|
||||
if options.AudioFormats != "" {
|
||||
cmd.Args = append(cmd.Args, "--audio-format", options.AudioFormats)
|
||||
}
|
||||
|
||||
if result.Options.ProxyUrl != "" {
|
||||
cmd.Args = append(cmd.Args, "--proxy", result.Options.ProxyUrl)
|
||||
}
|
||||
|
Reference in New Issue
Block a user