Search code examples
youtube-apiyoutube-data-api

YouTube API v3 - List uploaded videos


How do I list the user's uploaded videos in the V3 api?


Solution

  • The first step is getting the channel id for that user. We can do this with request to the Channels service. Here's a JS example.

    var request = gapi.client.youtube.channels.list({
      // mine: true indicates that we want to retrieve the channel for the authenticated user.
      mine: true,
      part: 'contentDetails'
    });
    request.execute(function(response) {
      playlistId = response.result.channels[0].contentDetails.uploads;
    });
    

    Once we get the playlist id we can use that to query for the list of uploaded videos from the PlaylistItems service.

    var request = gapi.client.youtube.playlistItems.list({
      id: playlistId,
      part: 'snippet',
    });
    request.execute(function(response) {
      // Go through response.result.playlistItems to view list of uploaded videos.
    });