Compare commits
No commits in common. "1a2b019b4bb7d9a6a660ac88e7a4da5220aea56e" and "a1330b3a3380ae4ab6fb47735f9f986345d0a0b1" have entirely different histories.
1a2b019b4b
...
a1330b3a33
1 changed files with 3 additions and 3 deletions
|
@ -10,7 +10,7 @@ import (
|
||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
var FileExtensions = []string {"webm","mp4","mkv"}
|
var FileExtensions = []string {".webm",".mp4",".mkv"}
|
||||||
|
|
||||||
func getRedirectURL(input string) (string, error) {
|
func getRedirectURL(input string) (string, error) {
|
||||||
request, err := http.NewRequest("GET", input, nil)
|
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) {
|
func getLargestYTFormat(input goutubedl.Result, sizeLimit float64) (format goutubedl.Format, err error) {
|
||||||
for i := len(input.Formats())-1; i >= 0; i-- {
|
for i := len(input.Formats())-1; i >= 0; i-- {
|
||||||
if input.Formats()[i].VBR > 0 && input.Formats()[i].ASR > 0 && slices.Contains(FileExtensions, input.Formats()[i].Ext) {
|
if input.Formats()[i].VBR > 0 && input.Formats()[i].ASR > 0 {
|
||||||
var size float64
|
var size float64
|
||||||
if input.Formats()[i].FilesizeApprox > 0 {
|
if input.Formats()[i].FilesizeApprox > 0 {
|
||||||
size = input.Formats()[i].FilesizeApprox
|
size = input.Formats()[i].FilesizeApprox
|
||||||
} else {
|
} else {
|
||||||
size = input.Formats()[i].Filesize
|
size = input.Formats()[i].Filesize
|
||||||
}
|
}
|
||||||
if size <= sizeLimit {
|
if size <= sizeLimit && input.Formats()[i].FormatID != "17" {
|
||||||
return input.Formats()[i], nil
|
return input.Formats()[i], nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue