5

There are 3 ways that i can access a stream from a channel /live:

I know how to get it from the channel_id and i know how to get the channel_id from the username. My problem is on the 3rd case. Is it possible to get the channel_id from this custom URL?

Second question. The way i get the video URL from the channel id is using the following endpoint:

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

I've notice that if the channel has a live stream going on at /channel-id/live and have other stream on with specific URL I have no warranty that the video URL that i get is the one associated with the /channel-id/live. Is that a way to get this specific video?

Rafael Reis
  • 600
  • 2
  • 6
  • 19

1 Answers1

1

I know this post is pretty old but I recently faced this issue as well and was able to find an answer from this SO post.

Basically, take the CHANNEL_ID and utilize YouTube's Search endpoint like this:

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

This request will return a youtube#video object that contains the videoId

Zac Clark
  • 125
  • 1
  • 10