YouTube API 用于获取频道上的所有视频 [英] YouTube API to fetch all videos on a channel
问题描述
我们需要 YouTube 频道名称的视频列表(使用 API).
We need a video list by channel name of YouTube (using the API).
我们可以使用以下 API 获取频道列表(仅频道名称):
We can get a channel list (only channel name) by using the below API:
https://gdata.youtube.com/feeds/api/channels?v=2&q=tendulkar
以下是频道的直接链接
https://www.youtube.com/channel/UCqAEtEr0A0Eo2IVcuWBfB9g
或者
WWW.YouTube.com/channel/HC-8jgBP-4rlI
现在,我们需要频道 >> UCqAEtEr0A0Eo2IVcuWBfB9g 或 HC-8jgBP-4rlI 的视频.
Now, we need videos of channel >> UCqAEtEr0A0Eo2IVcuWBfB9g or HC-8jgBP-4rlI.
我们尝试过
https://gdata.youtube.com/feeds/api/videos?v=2&uploader=partner&User=UC7Xayrf2k0NZiz3S04WuDNQhttps://gdata.youtube.com/feeds/api/videos?v=2&uploader=partner&q=UC7Xayrf2k0NZiz3S04WuDNQ
但是,它没有帮助.
我们需要频道上发布的所有视频.上传到频道的视频可能来自多个用户,因此我认为提供用户参数不会有帮助...
We need all the videos posted on the channel. Videos uploaded to a channel can be from multiple users thus I don't think providing a user parameter would help...
推荐答案
你需要看看 YouTube数据 API.您将在那里找到有关如何访问 API 的文档.您还可以找到客户端库.
You need to look at the YouTube Data API. You will find there documentation about how the API can be accessed. You can also find client libraries.
您也可以自己提出请求.以下是从频道中检索最新视频的示例 URL:
You could also make the requests yourself. Here is an example URL that retrieves the latest videos from a channel:
https://www.googleapis.com/youtube/v3/search?key={your_key_here}&channelId={channel_id_here}&part=snippet,id&order=date&maxResults=20
之后,您将收到一个带有视频 ID 和详细信息的 JSON
,您可以像这样构建您的视频 URL:
After that you will receive a JSON
with video ids and details, and you can construct your video URL like this:
http://www.youtube.com/watch?v={video_id_here}
这篇关于YouTube API 用于获取频道上的所有视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!