从 YouTube 频道获取直播

Getting livestreams from YouTube channel(从 YouTube 频道获取直播)

本文介绍了从 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?

推荐答案

您无法获取 liveBroadcastliveStream 对象,该对象不属于您进行身份验证的用户或频道.每个对象的 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.

如果您想检索其他频道当前直播的信息,您必须使用标准 搜索/列表端点:

If you want to retrieve information on another channel's current live broadcasts, you have to use the standard Search/list endpoint:

部分->片段

channelId -> [直播活动的频道/用户的channelId]

eventType ->直播

类型->视频(将eventType设置为live时需要)

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

这篇关于从 YouTube 频道获取直播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:从 YouTube 频道获取直播

基础教程推荐