Using YouTube v3 API to retrieve a list of videos for a channel without live events

大城市里の小女人 提交于 2019-12-24 07:59:02

问题


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

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.

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.

I tried calling:

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.


回答1:


You can try to set the publishedBefore property https://developers.google.com/youtube/v3/docs/search/list



来源:https://stackoverflow.com/questions/41659993/using-youtube-v3-api-to-retrieve-a-list-of-videos-for-a-channel-without-live-eve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!