|
| 1 | +## Samples in this directory: |
| 2 | + |
| 3 | +### [Authorize a request](/youtube/api-samples/blob/master/javascript/auth.js) |
| 4 | + |
| 5 | +Description: The <code>auth.js</code> script demonstrates how to use the Google APIs Client Library for JavaScript |
| 6 | +to provide API access and authorize user requests. All of the subsequent samples on this page use this script to |
| 7 | +authorize their requests.<br><br> |
| 8 | +For requests that do not require authentication, you could also use the |
| 9 | +<code>key</code> query parameter to specify an API key rather than using OAuth 2.0.<br><br> |
| 10 | +<strong>Note:</strong> You need to update the client ID in the <code>auth.js</code> file. You can obtain your own |
| 11 | +client ID by registering your application in the |
| 12 | +<a href="https://console.developers.google.com">Google Developers Console</a>. |
| 13 | + |
| 14 | +### [Do resumable uploads with CORS](/youtube/api-samples/blob/master/javascript/cors_upload.js) |
| 15 | + |
| 16 | +Description: This code sample demonstrates how to execute a resumable upload using XHR/CORS. |
| 17 | + |
| 18 | +### [Upload a video](/youtube/api-samples/blob/master/javascript/upload_video.js) |
| 19 | + |
| 20 | +Method: youtube.videos.insert<br> |
| 21 | +Description: This code sample calls the API's <code>videos.insert</code> method to upload a video to the channel |
| 22 | +associated with the request. |
| 23 | + |
| 24 | +### [Retrieve my uploads](/youtube/api-samples/blob/master/javascript/my_uploads.js) |
| 25 | + |
| 26 | +Method: youtube.playlistItems.list<br> |
| 27 | +Description: This code sample calls the API's <code>playlistItems.list</code> method to retrieve a list of |
| 28 | +videos uploaded to the channel associated with the request. The code also calls the <code>channels.list</code> |
| 29 | +method with the <code>mine</code> parameter set to <code>true</code> to retrieve the playlist ID that identifies |
| 30 | +the channel's uploaded videos. |
| 31 | + |
| 32 | +### [Search by keyword](/youtube/api-samples/blob/master/javascript/search.js) |
| 33 | + |
| 34 | +Method: youtube.search.list<br> |
| 35 | +Description: This code sample calls the API's <code>search.list</code> method to retrieve search results associated |
| 36 | +with a particular keyword. |
| 37 | + |
| 38 | +### [Create a playlist](/youtube/api-samples/blob/master/javascript/playlist_updates.js) |
| 39 | + |
| 40 | +Method: youtube.playlists.insert<br> |
| 41 | +Description: This sample creates a private playlist and add videos to it. (You could, of course, modify the code so |
| 42 | +that it creates a publicly visible playlist or so that it checks a form value to determine whether the playlist is |
| 43 | +public or private.) Note that you need to update the client ID in the <code>auth.js</code> file to run this code. |
| 44 | + |
| 45 | +### [Calling the Analytics API](/youtube/api-samples/blob/master/javascript/analytics_codelab.js) |
| 46 | + |
| 47 | +Method: youtubeAnalytics.reports.query<br> |
| 48 | +Description: This sample uses the YouTube Data and YouTube Analytics APIs to retrieve YouTube channel metrics. |
| 49 | +The samples use the <a target="_blank" href="/api-client-library/javascript/">Google APIs JavaScript client library</a> |
| 50 | +to demonstrate API functionality. The <a href="/youtube/analytics/v1/sample-application">Building a Sample Application</a> |
| 51 | +document walks you through the steps of building this application and discusses different portions of this code in more |
| 52 | +detail. |
0 commit comments