Compare commits

...

3 commits

View file

@ -10,7 +10,7 @@ import (
"golang.org/x/exp/slices"
)
var FileExtensions = []string {".webm",".mp4",".mkv"}
var FileExtensions = []string {"webm","mp4","mkv"}
func getRedirectURL(input string) (string, error) {
request, err := http.NewRequest("GET", input, nil)
@ -97,14 +97,14 @@ func getLargestDashFormat(input goutubedl.Result, sizeLimit float64) (videoForma
func getLargestYTFormat(input goutubedl.Result, sizeLimit float64) (format goutubedl.Format, err error) {
for i := len(input.Formats())-1; i >= 0; i-- {
if input.Formats()[i].VBR > 0 && input.Formats()[i].ASR > 0 {
if input.Formats()[i].VBR > 0 && input.Formats()[i].ASR > 0 && slices.Contains(FileExtensions, input.Formats()[i].Ext) {
var size float64
if input.Formats()[i].FilesizeApprox > 0 {
size = input.Formats()[i].FilesizeApprox
} else {
size = input.Formats()[i].Filesize
}
if size <= sizeLimit && input.Formats()[i].FormatID != "17" {
if size <= sizeLimit {
return input.Formats()[i], nil
}
}