Integrations / YouTube
YouTube
Search YouTube, read your channel, playlists and videos, and create playlists.
6 actions
OAuth 2
5 read1 write
Calls www.googleapis.com
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "youtube" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
| Scope | Why it is requested |
|---|---|
https://www.googleapis.com/auth/userinfo.email | See which Google account you connected |
https://www.googleapis.com/auth/youtube.readonly | See your YouTube channel, playlists and video details |
https://www.googleapis.com/auth/youtube | Create playlists on your YouTube account |
Actions
Create playlistwriteyoutube.create_playlistCreate a new playlist on the signed-in user's YouTube channel.
Needs scope: https://www.googleapis.com/auth/youtube
| Input | Type | Description | |
|---|---|---|---|
title | string | Required | Playlist title |
description | string | Optional | Playlist description |
privacy_status | string | Optional | Who can see it |
await setu.execute({
userId: "user_1",
action: "youtube.create_playlist",
input: {
"title": "<title>"
},
});Get my channelreadyoutube.get_my_channelGet the signed-in user's own YouTube channel: its ID, title, subscriber and video counts, and the ID of its uploads playlist.
Needs scope: https://www.googleapis.com/auth/youtube.readonly
No input.
await setu.execute({
userId: "user_1",
action: "youtube.get_my_channel",
input: {},
});Get video detailsreadyoutube.get_videosGet the title, description, view and like counts and duration of one or more videos by ID.
Needs scope: https://www.googleapis.com/auth/youtube.readonly
| Input | Type | Description | |
|---|---|---|---|
video_ids | array of string | Required | Video IDs (up to 50) |
await setu.execute({
userId: "user_1",
action: "youtube.get_videos",
input: {
"video_ids": []
},
});List my playlistsreadyoutube.list_my_playlistsList the playlists owned by the signed-in user, with their IDs and titles.
Needs scope: https://www.googleapis.com/auth/youtube.readonly
| Input | Type | Description | |
|---|---|---|---|
max_results | integer | Optional | Playlists to return, 1 to 50 (default 5) |
page_token | string | Optional | nextPageToken from an earlier call |
await setu.execute({
userId: "user_1",
action: "youtube.list_my_playlists",
input: {},
});List playlist itemsreadyoutube.list_playlist_itemsList the videos in a playlist. Use the uploads playlist ID from get_my_channel to list a channel's own videos.
Needs scope: https://www.googleapis.com/auth/youtube.readonly
| Input | Type | Description | |
|---|---|---|---|
playlist_id | string | Required | Playlist ID |
max_results | integer | Optional | Items to return, 1 to 50 (default 5) |
page_token | string | Optional | nextPageToken from an earlier call |
await setu.execute({
userId: "user_1",
action: "youtube.list_playlist_items",
input: {
"playlist_id": "<playlist_id>"
},
});Search videosreadyoutube.search_videosSearch YouTube for videos matching a text query, optionally limited to one channel and sorted by date, rating or views.
Needs scope: https://www.googleapis.com/auth/youtube.readonly
| Input | Type | Description | |
|---|---|---|---|
q | string | Required | Search terms |
max_results | integer | Optional | Results to return, 1 to 50 (default 5) |
order | string | Optional | Sort order |
channel_id | string | Optional | Only videos from this channel ID |
page_token | string | Optional | nextPageToken from an earlier call |
await setu.execute({
userId: "user_1",
action: "youtube.search_videos",
input: {
"q": "<q>"
},
});