从频道中获取观看次数最多的视频并使用 v3 获取频道的精选视频 [英] Get the most viewed videos from a channel and get a channel's featured video using v3
问题描述
在几次小问题后终于让 API 正确连接后,我设法获取了几乎所有我需要的数据,但有两个例外:
After finally getting the API to connect properly after a couple of hiccups I've managed to grab pretty much all of the data I need fairly easily with 2 exceptions:
我需要一个特定频道中观看次数最多的 10 个视频的列表.我知道使用 video.list 您可以将图表设置为最流行,但是将 videoCategoryId 设置为频道上传的频道 ID 或播放列表 ID 似乎不起作用
I need a list of the 10 most viewed videos from a specific channel. I know with video.list you can set the chart to most popular, but setting the videoCategoryId to either the channel id or the playlist id of the channel's uploads doesn't seem to work
我还需要获取频道主页上的精选视频.我认为这在 API 中被称为 unsubscribedTrailer 并且在brandingSettings 下可用,但无法找到从channels.list 的结果中获取价值的方法
I also need to grab the video that is featured on the channel's home page. I think this is referred to in the API as unsubscribedTrailer and is available under brandingSettings but can't find a way to get at the value from the result of channels.list
我还尝试将brandingSettings 添加到listChannels 的部分字符串中,但它返回一个空对象 - 我假设我不是频道的所有者,即使我只想阅读它们而不是更新>
I've also tried adding brandingSettings to the parts string of listChannels but it returns an empty object - I assume as I'm not the owner of the channel even though I only want to read them and not update
推荐答案
videos->list 调用用于获取有关您已找到的视频的详细信息.
videos->list call is for getting details about videos you already found.
您需要做一个带有 id 的频道->列表以查找该频道的属性.
What you need is to do a channels->list with id to find properties of that channels.
精选视频是:brandingSettings.channel.unsubscribedTrailer一个>
要获取该频道最热门的视频:您可以执行 search->list 指定 channelId 和 order = viewcount
To get get most popular videos of that channel: you can do search->list with specifying the channelId and order = viewcount
这篇关于从频道中获取观看次数最多的视频并使用 v3 获取频道的精选视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!