The YouTube service allows you to use the YouTube Data API and YouTube Live Streaming API in Apps Script. This API gives users the ability to manage their videos, playlists, channels, and live events.
Reference
For detailed information on this service, see the following reference documentation:
Like all advanced services in Apps Script, the YouTube service uses the same objects, methods, and parameters as the public API. For more information, see How method signatures are determined.
To report issues and find other support, see the corresponding support pages:
Sample code
The sample code below uses version 3 of the YouTube Data API.
Search by keyword
This function searches for videos about dogs, then logs the video IDs and title. Note that this sample limits the results to 25. To return more results, pass additional parameters as shown in the YouTube Data API reference documentation.
Retrieve uploads
This function retrieves the user's uploaded videos. It does this using the following steps:
- Fetches the user's channel
- Fetches the user's
uploads
playlist - Iterates through this playlist and logs the video IDs and titles
- If there is a next page of results, fetches it, then returns to step 3
Subscribe to channel
This sample subscribes the user to the Google Developers channel on YouTube.