From 61795cd0ad1c8f6f64f1a35ab336e3a0cf3dff9d Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Tue, 28 Jul 2015 13:56:41 +0100 Subject: [PATCH] Added 25 song limit of playlist --- service_youtube.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/service_youtube.go b/service_youtube.go index da9b641..644dea7 100644 --- a/service_youtube.go +++ b/service_youtube.go @@ -404,16 +404,16 @@ func NewYouTubePlaylist(user, id string) (*YouTubePlaylist, error) { title: title, } - // Retrieve items in playlist &maxResults=25 - url = fmt.Sprintf("https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=%s&key=%s", + // Retrieve items in playlist + url = fmt.Sprintf("https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId=%s&key=%s", id, os.Getenv("YOUTUBE_API_KEY")) if apiResponse, err = PerformGetRequest(url); err != nil { return nil, err } numVideos, _ := apiResponse.Int("pageInfo", "totalResults") - // if numVideos > 2 { - // numVideos = 2 - // } + if numVideos > 25 { + numVideos = 25 + } for i := 0; i < numVideos; i++ { index := strconv.Itoa(i)