YouTube API v3 - 列出上传的视频 [英] YouTube API v3 - List uploaded videos

查看:32
本文介绍了YouTube API v3 - 列出上传的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 V3 api 中列出用户上传的视频?

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

推荐答案

第一步是获取该用户的频道 ID.我们可以通过对 Channels 服务的请求来做到这一点.这是一个 JS 示例.

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;
});

一旦我们获得播放列表 ID,我们就可以使用它来查询来自 PlaylistItems 服务的上传视频列表.

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({
  playlistId: playlistId,
  part: 'snippet',
});
request.execute(function(response) {
  // Go through response.result.playlistItems to view list of uploaded videos.
});

这篇关于YouTube API v3 - 列出上传的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆