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:
parent
6ac3c4bbeb
commit
34a630808c
1 changed files with 2 additions and 2 deletions
|
@ -81,7 +81,7 @@ func fetchYouTubeWatchTimeForSingleEntry(websiteURL string) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchYouTubeWatchTimeInBulk(entries []*model.Entry) {
|
func fetchYouTubeWatchTimeInBulk(entries []*model.Entry) {
|
||||||
var videosEntriesMapping = make(map[string]*model.Entry)
|
var videosEntriesMapping = make(map[string]*model.Entry, len(entries))
|
||||||
var videoIDs []string
|
var videoIDs []string
|
||||||
|
|
||||||
for _, entry := range entries {
|
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)
|
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 {
|
for _, video := range videos.Items {
|
||||||
duration, err := parseISO8601(video.ContentDetails.Duration)
|
duration, err := parseISO8601(video.ContentDetails.Duration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue