且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Android的*** API V3中按频道ID获取***实时流?

更新时间:2023-02-21 07:53:42

我遇到了同样的问题,并且设法找到了解决方案. ***实际上为此提供了一个API.如果您具有频道ID,则可以使用搜索API获取当前有效的实时视频ID.

I have faced the same problem and managed to figure out a solution for the same. *** actually provides an API for this purpose. You can use the search API to get the currently active Live Video ID, if you have the channel ID.

使用以下API:

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

这里的关键因素是必须将eventType设置为live,将type设置为video.

The key factor here is you have to set the eventType to live and type to video.

要获取频道ID,如果您具有频道的用户名,则可以使用以下请求.

For getting the channel ID, you can use the following request, if you have the channel's username.

https://www.googleapis.com/***/v3/channels?part=contentDetails&forUsername={CHANNEL_USER_NAME}&key={YOUR_API_KEY}