使用 YouTube v3 API 检索没有直播活动的频道的视频列表 [英] Using YouTube v3 API to retrieve a list of videos for a channel without live events
问题描述
我正在使用 YouTube v3 API 来检索使用此 URL 的视频列表:
I am using the YouTube v3 API to retrieve a list of videos using this URL:
https://www.googleapis.com/youtube/v3/search?key=[APIKEY]&channelId=[ChannelID]&part=snippet,id&order=date&type=video&maxResults=25
但是,YouTube 包含此查询的即将到来的直播结果.实时结果可以是作者提前几天放置的占位符,不包含任何实际内容,所以我宁愿不向用户展示.
However, YouTube includes upcoming live broadcast results for this query. The live results can be place-holder the author puts days in advance and don't contain any real content so I rather not show them to the users.
我可以在我的代码中过滤实时结果,但我更希望用户在每次查询时看到固定数量的视频(例如25"),并且在查询后过滤会导致数量较少.
I could filter the live results in my code, but I would rather the user sees a fixed number of videos per query (e.g. "25"), and filtering after the query would result in a lower number.
我试着打电话:
https://www.googleapis.com/youtube/v3/search?key=[APIKEY]&channelId=[ChannelID]&part=snippet,id&order=date&type=video**&eventType=completed**&maxResults=25
但它只返回已完成的直播活动,不显示未直播的视频.
But it only returns completed live events and doesn't show videos that were not broadcast live.
推荐答案
可以尝试设置publishedBefore属性https://developers.google.com/youtube/v3/docs/search/列表
You can try to set the publishedBefore property https://developers.google.com/youtube/v3/docs/search/list
这篇关于使用 YouTube v3 API 检索没有直播活动的频道的视频列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!