@@ -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,11 +38,12 @@ func main() {
3838 log .Fatalf ("Error making search API call: %v" , err )
3939 }
4040
41+ // Group video, channel, and playlist results in separate lists.
4142 videos := make (map [string ]string )
4243 channels := make (map [string ]string )
4344 playlists := make (map [string ]string )
4445
45- // Iterate through each item and add it to its respective list
46+ // Iterate through each item and add it to the correct list.
4647 for _ , item := range response .Items {
4748 switch item .Id .Kind {
4849 case "youtube#video" :
@@ -59,8 +60,10 @@ func main() {
5960 printIDs ("Playlists" , playlists )
6061}
6162
62- // Given a string section name and list, prints the section name
63- // and IDs separated by commas
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.
6467func printIDs (sectionName string , matches map [string ]string ) {
6568 fmt .Printf ("%v:\n " , sectionName )
6669 for id , title := range matches {
0 commit comments