Getting livestreams from YouTube channel

醉酒当歌 提交于 2019-12-24 15:33:08

问题


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.

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.

What API call do I need to make?


回答1:


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.

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 (required when setting eventType to live)

HTTP GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={channelId}&eventType=live&type=video&key={YOUR_API_KEY}


来源:https://stackoverflow.com/questions/34904302/getting-livestreams-from-youtube-channel

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