From 55e7486f50325791cbcee59fcba8c8488db2809a Mon Sep 17 00:00:00 2001 From: dilap54 Date: Mon, 3 Feb 2025 20:45:42 +0300 Subject: [PATCH] add foramt chose for subtitlse --- goutubedl.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/goutubedl.go b/goutubedl.go index b32a955..47ad790 100644 --- a/goutubedl.go +++ b/goutubedl.go @@ -225,15 +225,16 @@ 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 - DownloadSubtitlesLang []string - DownloadSections string // --download-sections - Impersonate string // --impersonate + Type Type + PlaylistStart uint // --playlist-start + PlaylistEnd uint // --playlist-end + Downloader string // --downloader + DownloadThumbnail bool + DownloadSubtitles bool + DownloadSubtitlesLang []string + DownloadSubtitlesFormat string + DownloadSections string // --download-sections + Impersonate string // --impersonate ProxyUrl string // --proxy URL http://host:port or socks5://host:port UseIPV4 bool // -4 Make all connections via IPv4 @@ -491,6 +492,9 @@ func infoFromURL( } for _, caption := range info.AutomaticCaptions[lang] { + if caption.Ext != options.DownloadSubtitlesFormat { + continue + } resp, respErr := get(caption.URL) if respErr == nil { buf, err := io.ReadAll(resp.Body)