2
votes


I got the problem when trying to get all of videos from a chanel.
Here is the chanel: http://www.youtube.com/channel/UC0vrmjhkmbCxYUGl8KNFxMA
I try to get Playlist with my API key but it returned an empty array:
https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId=UC0vrmjhkmbCxYUGl8KNFxMA&key=
Please help me.

1

1 Answers

8
votes

The channelId parameter does not specify a channel to return videos for. Think of it as a "filter" to only show playlists from a specific channel.

Instead, do this:

  1. Make a channel.list() API call with your channel ID and the part=contentDetails. Save the value under items[0][contentDetails][relatedPlaylists][uploads]. Example:

    GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=UC0vrmjhkmbCxYUGl8KNFxMA&key={YOUR_API_KEY}

  2. Make a playlistItems.list() API call with the value retrieved in the ID field. In your specific case, this is UU0vrmjhkmbCxYUGl8KNFxMA. The API call is:

    GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UU0vrmjhkmbCxYUGl8KNFxMA&key={YOUR_API_KEY}