从YouTube频道获取直播 [英] Getting livestreams from YouTube channel

查看:913
本文介绍了从YouTube频道获取直播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试跟踪特定频道的直播观众. 当我获得流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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆