# YouTube

YouTube (opens new window) is an online video-sharing platform. YouTube allows users to upload, view, rate, share, add to playlists, report, comment on videos, and subscribe to other users.

🔑 Credentials

You can find authentication information for this node here.

# Basic Operations


Channel
  • Retrieve a channel
  • Retrieve all channels
  • Update a channel
  • Upload a channel banner
Playlist
  • Create a playlist
  • Delete a playlist
  • Get a playlist
  • Retrieve all playlists
  • Update a playlist
Playlist Item
  • Add an item to a playlist
  • Delete a item from a playlist
  • Get a playlist's item
  • Retrieve all playlist items
Video
  • Delete a video
  • Get a video
  • Retrieve all videos
  • Rate a video
  • Update a video
  • Upload a video
Video Category
  • Retrieve all video categories

# Example Usage

This workflow allows you to upload a video, create a playlist, and add the video to the playlist in YouTube. You can also find the workflow (opens new window) on n8n.io. This example usage workflow would use the following nodes.

The final workflow should look like the following image.

A workflow with the Gmail node

# 1. Start node

The start node exists by default when you create a new workflow.

# 2. Read Binary File node

  1. Enter the path to the video file you want to upload in the File Path field.
  2. Click on Execute Node to run the node.

Using the Read Binary File node to get the video

# 3. YouTube node (upload: video)

  1. First of all, you'll have to enter credentials for the YouTube node. You can find out how to do that here.
  2. Select 'Video' from the Resource dropdown list.
  3. Select 'Upload' from the Operation dropdown list.
  4. Enter the title of the video in the Title field.
  5. Select the region code from Region Code dropdown list.
  6. Select the video category from the Category ID dropdown list.
  7. Click on Execute Node to run the node.

Using the YouTube node to upload a video

# 4. YouTube1 node (create: playlist)

  1. Select the credentials that you entered in the previous YouTube node.
  2. Select 'Playlist' from the Resource dropdown list.
  3. Select 'Create' from the Operation dropdown list.
  4. Enter the title of the playlist in the Title field.
  5. Click on Execute Node to run the node.

Using the YouTube node to create a playlist

# 5. YouTube2 node (add: playlistItem)

  1. Select the credentials that you entered in the previous YouTube node.
  2. Select 'Playlist Item' from the Resource dropdown list.
  3. Select the playlist from the Playlist ID dropdown list.
  4. Click on the gears icon next to the Video ID field and click on Add Expression.
  5. Select the following in the Variable Selector section: Nodes > YouTube > Output Data > JSON > id. You can also add the following expression: {{$node["YouTube"].json["id"]}}.
  6. Click on Execute Node to run the node.

Using the YouTube node to add the video to the playlist

# Further Reading