@@ -29,7 +29,7 @@ func main() {
2929 log .Fatalf ("Error creating new YouTube client: %v" , err )
3030 }
3131
32- // Make the API call to YouTube.
32+ // Make the API call to YouTube
3333 call := service .Search .List ("id,snippet" ).
3434 Q (* query ).
3535 MaxResults (* maxResults )
@@ -38,12 +38,11 @@ func main() {
3838 log .Fatalf ("Error making search API call: %v" , err )
3939 }
4040
41- // Group video, channel, and playlist results in separate lists.
4241 videos := make (map [string ]string )
4342 channels := make (map [string ]string )
4443 playlists := make (map [string ]string )
4544
46- // Iterate through each item and add it to the correct list.
45+ // Iterate through each item and add it to its respective list
4746 for _ , item := range response .Items {
4847 switch item .Id .Kind {
4948 case "youtube#video" :
@@ -60,10 +59,8 @@ func main() {
6059 printIDs ("Playlists" , playlists )
6160}
6261
63- // Print the ID and title of each result in a list as well as a name that
64- // identifies the list. For example, print the word section name "Videos"
65- // above a list of video search results, followed by the video ID and title
66- // of each matching video.
62+ // Given a string section name and list, prints the section name
63+ // and IDs separated by commas
6764func printIDs (sectionName string , matches map [string ]string ) {
6865 fmt .Printf ("%v:\n " , sectionName )
6966 for id , title := range matches {
0 commit comments