Reputation: 37
How to known if a stream is live (and get amount of current viewers) from a youtube channel id ?
We can have some informations about livestream with video id but not with channel id.
Thanks,
Upvotes: 0
Views: 264
Reputation: 322
First of all you have to use the search.list to use your channelID in checking if the channel has a live stream video. Then if it has, then get the videoId of the video livestream. Now, use the video.list to get the current viewers. Note you should use the liveStreamingDetails
as your part parameter here.
You may also use https://www.youtube.com/live_stats?v=[videoID]
after you have got the video id from search.list to get the number of viewers
Upvotes: 2