add foramt chose for subtitlse
Some checks failed
Build on push and PRs / build (push) Failing after 4s
Some checks failed
Build on push and PRs / build (push) Failing after 4s
This commit is contained in:
22
goutubedl.go
22
goutubedl.go
@ -225,15 +225,16 @@ var TypeFromString = map[string]Type{
|
|||||||
|
|
||||||
// Options for New()
|
// Options for New()
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Type Type
|
Type Type
|
||||||
PlaylistStart uint // --playlist-start
|
PlaylistStart uint // --playlist-start
|
||||||
PlaylistEnd uint // --playlist-end
|
PlaylistEnd uint // --playlist-end
|
||||||
Downloader string // --downloader
|
Downloader string // --downloader
|
||||||
DownloadThumbnail bool
|
DownloadThumbnail bool
|
||||||
DownloadSubtitles bool
|
DownloadSubtitles bool
|
||||||
DownloadSubtitlesLang []string
|
DownloadSubtitlesLang []string
|
||||||
DownloadSections string // --download-sections
|
DownloadSubtitlesFormat string
|
||||||
Impersonate string // --impersonate
|
DownloadSections string // --download-sections
|
||||||
|
Impersonate string // --impersonate
|
||||||
|
|
||||||
ProxyUrl string // --proxy URL http://host:port or socks5://host:port
|
ProxyUrl string // --proxy URL http://host:port or socks5://host:port
|
||||||
UseIPV4 bool // -4 Make all connections via IPv4
|
UseIPV4 bool // -4 Make all connections via IPv4
|
||||||
@ -491,6 +492,9 @@ func infoFromURL(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, caption := range info.AutomaticCaptions[lang] {
|
for _, caption := range info.AutomaticCaptions[lang] {
|
||||||
|
if caption.Ext != options.DownloadSubtitlesFormat {
|
||||||
|
continue
|
||||||
|
}
|
||||||
resp, respErr := get(caption.URL)
|
resp, respErr := get(caption.URL)
|
||||||
if respErr == nil {
|
if respErr == nil {
|
||||||
buf, err := io.ReadAll(resp.Body)
|
buf, err := io.ReadAll(resp.Body)
|
||||||
|
Reference in New Issue
Block a user