Added file extension check to YT download

This commit is contained in:
Logan G 2022-09-16 18:32:22 -06:00
parent d3d7cc9a9c
commit f4705a0b7f
Signed by: logan
GPG key ID: E328528C921E7A7A

View file

@ -97,7 +97,7 @@ 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 { if input.Formats()[i].VBR > 0 && input.Formats()[i].ASR > 0 && slices.Contains(FileExtensions, input.Formats()[i].Ext) {
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