从YouTube频道获取直播 [英] Getting livestreams from YouTube channel
问题描述
我正在尝试跟踪特定频道的直播观众. 当我获得流ID并手动使用它时,这没问题.
I am trying to keep track of the livestream viewers of a specific channel. This is no problem when I have got the stream ID and use it manually.
但是我希望我的程序能够自动跟踪即将到来的直播.因此,我想从频道中获取下一个即将到来的直播的直播ID.我一直在浏览API的文档,但找不到任何东西.
However I want my program to be able to track upcoming livestream automatically. So I want to get the livestream ID from the channel for the next upcoming livestream. I have been looking through the documentation from the API, but I couldn't find anything.
我需要进行什么API调用?
What API call do I need to make?
推荐答案
您无法获得 liveStream
对象不属于您被认证为的用户或频道.每个对象的list
终结点都要求您验证自己的频道/用户身份,才能仅检索自己的实时事件.
You cannot get the liveBroadcast
or liveStream
object that does not belong to the user or channel you are authenticated as. The list
endpoint for each object requires your to authenticate as your own channel/user to retrieve your own live events only.
如果您想检索有关另一个频道当前直播的信息,则必须使用标准的 Search/list
端点:
If you want to retrieve information on another channel's current live broadcasts, you have to use the standard Search/list
endpoint:
part -> snippet
channelId
-> [channelId of the channel/user with the live event]
eventType -> live
type -> video
(将eventType
设置为live
时必需)
HTTP GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={channelId}&eventType=live&type=video&key={YOUR_API_KEY}
这篇关于从YouTube频道获取直播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!