Description: The auth.js script demonstrates how to use the Google APIs Client Library for JavaScript
to provide API access and authorize user requests. All of the subsequent samples on this page use this script to
authorize their requests.
For requests that do not require authentication, you could also use the
key query parameter to specify an API key rather than using OAuth 2.0.
Note: You need to update the client ID in the auth.js file. You can obtain your own
client ID by registering your application in the
Google Developers Console.
Description: This code sample demonstrates how to execute a resumable upload using XHR/CORS.
Method: youtube.videos.insert
Description: This code sample calls the API's videos.insert method to upload a video to the channel
associated with the request.
Method: youtube.playlistItems.list
Description: This code sample calls the API's playlistItems.list method to retrieve a list of
videos uploaded to the channel associated with the request. The code also calls the channels.list
method with the mine parameter set to true to retrieve the playlist ID that identifies
the channel's uploaded videos.
Method: youtube.search.list
Description: This code sample calls the API's search.list method to retrieve search results associated
with a particular keyword.
Method: youtube.playlists.insert
Description: This sample creates a private playlist and add videos to it. (You could, of course, modify the code so
that it creates a publicly visible playlist or so that it checks a form value to determine whether the playlist is
public or private.) Note that you need to update the client ID in the auth.js file to run this code.
Method: youtubeAnalytics.reports.query
Description: This sample uses the YouTube Data and YouTube Analytics APIs to retrieve YouTube channel metrics.
The samples use the Google APIs JavaScript client library
to demonstrate API functionality. The Building a Sample Application
document walks you through the steps of building this application and discusses different portions of this code in more
detail.