1
- /** START SECTION searchByTopic **/
2
1
// TITLE: Search by topic
3
2
// DESCRIPTION: use_function_comment
4
3
// API_METHOD: youtube.search.list
@@ -20,9 +19,7 @@ function searchByTopic() {
20
19
Logger . log ( '[%s] Title: %s' , item . id . videoId , item . snippet . title ) ;
21
20
}
22
21
}
23
- /** END SECTION searchByTopic **/
24
22
25
- /** START SECTION searchByKeyword **/
26
23
// TITLE: Search by keyword
27
24
// DESCRIPTION: use_function_comment
28
25
// API_METHOD: youtube.search.list
@@ -42,10 +39,8 @@ function searchByKeyword() {
42
39
Logger . log ( '[%s] Title: %s' , item . id . videoId , item . snippet . title ) ;
43
40
}
44
41
}
45
- /** END SECTION searchByKeyword **/
46
42
47
43
48
- /** START SECTION retrieveMyUploads **/
49
44
// TITLE: Retrieve my uploads
50
45
// DESCRIPTION: use_function_comment
51
46
// API_METHOD: youtube.channels.list
@@ -97,9 +92,7 @@ function retrieveMyUploads() {
97
92
}
98
93
}
99
94
}
100
- /** END SECTION retrieveMyUploads **/
101
95
102
- /** START SECTION updateVideo **/
103
96
// TITLE: Update video
104
97
// DESCRIPTION: use_function_comment
105
98
// API_METHOD: youtube.videos.update
@@ -139,9 +132,7 @@ function updateVideo() {
139
132
YouTube . Videos . update ( resource , 'id,snippet' ) ;
140
133
}
141
134
}
142
- /** END SECTION updateVideo **/
143
135
144
- /** START SECTION addSubscription **/
145
136
// TITLE: Subscribe to channel
146
137
// DESCRIPTION: use_function_comment
147
138
// API_METHOD: youtube.subscriptions.insert
@@ -173,9 +164,7 @@ function addSubscription() {
173
164
}
174
165
}
175
166
}
176
- /** END SECTION addSubscription **/
177
167
178
- /** START SECTION postChannelBulletin **/
179
168
// TITLE: Post channel bulletin
180
169
// DESCRIPTION: use_function_comment
181
170
// API_METHOD: youtube.activities.insert
@@ -204,25 +193,26 @@ function postChannelBulletin() {
204
193
var response = YouTube . Activities . insert ( resource , 'snippet,contentDetails' ) ;
205
194
Logger . log ( response ) ;
206
195
}
207
- /** END SECTION postChannelBulletin **/
208
196
209
- /** START SECTION spreadsheetAnalytics **/
210
- // TITLE: YouTube Analytics export Google Sheets
197
+ // TITLE: Export YouTube Analytics data to Google Sheets
211
198
// DESCRIPTION: use_function_comment
212
- // API_METHOD: youtubeanalytics .reports.query
199
+ // API_METHOD: youtubeAnalytics .reports.query
213
200
/**
214
- * This function uses the YouTube Analytics API to fetch data about our channel, creating
215
- * a new Google Sheet in our Drive with the data.
201
+ * This function uses the YouTube Analytics API to fetch data about the
202
+ * authenticated user's channel, creating a new Google Sheet in the user's Drive
203
+ * with the data.
216
204
*
217
- * The first part of this sample demonstrates a simple YouTube Analytics API call. This function
218
- * first fetches the active user's channel ID. Using this channel ID, the function makes an
219
- * analytics API call to retrieve view, likes, dislike and share data for the last 30 days. This
220
- * is returned in a response object containing a 2D array.
205
+ * The first part of this sample demonstrates a simple YouTube Analytics API
206
+ * call. This function first fetches the active user's channel ID. Using that
207
+ * ID, the function makes a YouTube Analytics API call to retrieve views,
208
+ * likes, dislikes and shares for the last 30 days. The API returns the data
209
+ * in a response object that contains a 2D array.
221
210
*
222
- * The second part of the sample constructs a Spreadsheet. This spreadsheet is placed in the active
223
- * user's Google Drive with the name 'YouTube Report' and date range in the title. The function
224
- * populates the spreadsheet with the API response, then locks columns and rows that will define
225
- * a chart axes. A stacked column chart is added for the spreadsheet.
211
+ * The second part of the sample constructs a Spreadsheet. This spreadsheet
212
+ * is placed in the authenticated user's Google Drive with the name
213
+ * 'YouTube Report' and date range in the title. The function populates the
214
+ * spreadsheet with the API response, then locks columns and rows that will
215
+ * define a chart axes. A stacked column chart is added for the spreadsheet.
226
216
*/
227
217
function spreadsheetAnalytics ( ) {
228
218
// Get the channel ID
@@ -304,4 +294,3 @@ function spreadsheetAnalytics() {
304
294
sheet . insertChart ( chart ) ;
305
295
306
296
}
307
- /** END SECTION spreadsheetAnalytics **/
0 commit comments