fix: better slices allocation

pre-allocate slices' size when possible when extracting media
This commit is contained in:
stefanodvx 2025-04-28 15:57:30 +02:00
parent 0d986d4573
commit b5c5801ec2
8 changed files with 65 additions and 71 deletions

View file

@ -48,7 +48,6 @@ var Extractor = &models.Extractor{
}
func MediaListFromAPI(ctx *models.DownloadContext) ([]*models.Media, error) {
var mediaList []*models.Media
client := util.GetHTTPClient(ctx.Extractor.CodeName)
response, err := GetVideo(
@ -109,11 +108,7 @@ func MediaListFromAPI(ctx *models.DownloadContext) ([]*models.Media, error) {
}
}
if len(media.Formats) > 0 {
mediaList = append(mediaList, media)
}
return mediaList, nil
return []*models.Media{media}, nil
}
func GetVideo(