How do I obtain a list of all videos in a channel using the YouTube Data API v3?

后端 未结 1 2041
星月不相逢
星月不相逢 2020-12-11 20:48

I\'m using the YouTube API 3 for a client and am not getting all current videos.

The API Explorer has 4 results: https://www.googleapis.com/youtube/v3/search?part=id

相关标签:
1条回答
  • 2020-12-11 21:39

    The API call that you should make if you want to get the videos in a channel is a youtube.playlistItems.list() with the playlistId of the "uploads" playlist for the channel. (This usually stars with UU..., but that's an implementation detail that might change in the future.

    Here's an example of the call in the API Explorer.

    Getting the same data via a search operation isn't guaranteed to return everything; the search index isn't a replacement for the backend data that you can obtain via the youtube.playlistItems.list() call. It's very much the same point raised in this blog post (though the focus there is on v2).

    We just posted a YouTube video talking about how to get the videos in a channel, and there's samples illustrates how to make the actual API calls from your code in the documentation.

    0 讨论(0)
提交回复
热议问题