Compare commits
3 commits
a1330b3a33
...
1a2b019b4b
Author | SHA1 | Date | |
---|---|---|---|
1a2b019b4b | |||
f4705a0b7f | |||
d3d7cc9a9c |
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue