如何使用新的 YouTube 数据 API (V3) 获取某个频道的上传视频列表? [英] How do I get a list of uploaded videos for a certain channel with the new YouTube Data API (V3)?

查看:16
本文介绍了如何使用新的 YouTube 数据 API (V3) 获取某个频道的上传视频列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取所有上传到频道的视频的视频 ID 列表.我还想使用新版本的 YouTube 数据 API (V3).我该怎么做?

I am trying to get a list of video ids for all uploaded videos to a channel. I would also like to use the new version of the YouTube Data API (V3). How do I do this?

推荐答案

您必须获取上传播放列表 id 才能上传每个视频.为此,您需要获取频道 ID.从频道 ID 获得播放列表 ID 后,这非常简单.我已经写出了下面所有三个的步骤.

You have to get the upload playlist id to get each videos uploaded. To get that, you need to get the channel id. After you have the playlist id from the channel id, it is pretty simple. I have written out the steps for all three below.

此外,我们还提供 PubSubHubBub,让您每次向频道添加新视频时都会收到提醒,或者您可以使用 SUP(V2) 在调用之前查看哪些资源发生了变化.

Also, we offer PubSubHubBub which allows you to be alerted every time a new video is added to a channel, or you could use SUP (V2) to see which resources have changed before making the calls.

获取 V3 中频道的所有上传视频的视频 ID 的说明

  1. 获取你想要的频道的频道ID(你可能只需要这样做一次,然后你可以保存它)

  1. Get the channel id for the channel you want (you probably only need to do this once, then you can save it)

  • 使用 search.list
  • type设置为channel
  • q 设置为您想要的频道名称
  • 获取频道 ID(类似于:channelId":UC0X2VuXXXXXXXXXXXXXXXX")
  • Use search.list
  • Set type to channel
  • Set q to the name of the channel you want
  • Grab the channel id (something like this: "channelId": "UC0X2VuXXXXXXXXXXXXXXXX")

使用第 1 步中的频道 ID 获取频道上传的播放列表 ID(您可能只需执行一次,然后可以保存)

Get the playlist id for the channel uploads using the channel id from step 1 (you probably only need to do this once, then you can save it)

  • 使用 channels.list
  • 在步骤 1 中将 id 设置为 UC0X2VuXXXXXXXXXXXXXXXX
  • contentDetails 中获取 uploads 键(类似于:uploads":UU0XXXXXXXXXXXXXXXXXXXXX")
  • Use channels.list
  • Set id to UC0X2VuXXXXXXXXXXXXXXXX from step 1
  • Grab the uploads key from contentDetails (something like this: "uploads": "UU0XXXXXXXXXXXXXXXXXXXX")

使用第 2 步中的播放列表 ID 通过播放列表中的播放列表项获取视频

Get the videos via the playlistitems in the playlist using the playlist id from step 2

  • 使用 playlistItems.list
  • 将第 2 步中的 playlistId 设置为 UU0XXXXXXXXXXXXXXXXXXXXX
  • 遍历每个 PlaylistItem 并提取视频 ID
  • Use playlistItems.list
  • Set playlistId to UU0XXXXXXXXXXXXXXXXXXXX from step 2
  • Go through each PlaylistItem and pull out the video id

这篇关于如何使用新的 YouTube 数据 API (V3) 获取某个频道的上传视频列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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