Getting realtime information about live streaming on YouTube

空扰寡人 提交于 2020-04-16 03:11:12

问题


I am building a webpage to display the live streaming status of several YouTube channels which I do not manage. The page will display a list of selected channels, with a ● red dot beside any channel which is live streaming right now. I also want the webpage to update that status in realtime, so if a channel begins live streaming, I need to immediately add the dot, and when a channel stops live streaming, I need to immediately remove the dot.

I can use the Data API to:

  • find upcoming events on a channel, using the search endpoint with a channelId, type=video and eventType=upcoming
  • retrieve the scheduledStartTime of an upcoming event, using the videos endpoint with part=liveStreamingDetails
  • find live events on a channel, using the search endpoint with a channelId, type=video and eventType=live
  • retrieve the actualStartTime of a live event, using the videos endpoint with part=liveStreamingDetails
  • retrieve the actualEndTime of a completed event, using the videos endpoint with part=liveStreamingDetails

I would really like to avoid polling the videos endpoint to monitor the status of live streams. Can I subscribe to a set of channel IDs or video IDs, to receive a message in real time when:

  • when an upcoming event actually starts live streaming
  • when a live stream is completed/terminated
  • for channels which I don't manage?

Is this possible?

来源:https://stackoverflow.com/questions/61051899/getting-realtime-information-about-live-streaming-on-youtube

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