1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

refactor(youtube): initiliaze two maps to the proper length

This commit is contained in:
jvoisin 2025-06-18 22:32:00 +02:00 committed by Frédéric Guillot
parent e366710529
commit c818d5bbb8

View file

@ -81,7 +81,7 @@ func fetchYouTubeWatchTimeForSingleEntry(websiteURL string) (int, error) {
}
func fetchYouTubeWatchTimeInBulk(entries []*model.Entry) {
var videosEntriesMapping = make(map[string]*model.Entry)
var videosEntriesMapping = make(map[string]*model.Entry, len(entries))
var videoIDs []string
for _, entry := range entries {
@ -154,7 +154,7 @@ func fetchYouTubeWatchTimeFromApiInBulk(videoIDs []string) (map[string]time.Dura
return nil, fmt.Errorf("youtube: unable to decode JSON: %v", err)
}
watchTimeMap := make(map[string]time.Duration)
watchTimeMap := make(map[string]time.Duration, len(videos.Items))
for _, video := range videos.Items {
duration, err := parseISO8601(video.ContentDetails.Duration)
if err != nil {