How to find out if a youtube channel is live!

Alright hey everyone, today I am going to teach you how to find out if you are live on youtube or not. Now twitch has an api for this and so does google! Lets get into it!

First you are going to need to go to https://console.developers.google.com/cloud-resource-manager if it asks you to login, login to your google account.

Once you are on the website you are going to click “Create Project” Part1

Once you have clicked on it name the project whatever you want.

Then click create!

Now go to https://console.developers.google.com/projectselector/apis/credentials?supportedpurview=project

Once there click “Select” and select the project you made.

Then it should bring you here. Part2

Click create credentials and click API key. This will create a api key exclusive to that project.

It should bring you to something like this: Part3

Copy the id and click “Close”.

Now head to https://console.developers.google.com/apis/library/youtube.googleapis.com/?project=[project name here] (enter the project name where it says “Project Name Here”) and click “Enable”! This will enable the youtube api!

Now get the channel id of the channel you want to check. Example: UCrZeCW9AijCnCEAaXMlTiTA

To find the id look in the url on the channel page. Example: youtube.com/channel/UCrZeCW9AijCnCEAaXMlTiTA

Now to create the link take this url: https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=[Channel’s Id Here]&type=video&eventType=live&key=[Key Here!]

And where it says “Channel’s Id Here” put the channel id there and remove the brackets. Where it says “[Key Here!]” put the api key you copied there and remove the brackets. Your url should end up something like this: https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCrZeCW9AijCnCEAaXMlTiTA&type=video&eventType=live&key=AIzaSyDSXwBazcctYf-FLQIcL72jGmEzeBkISu4! Now make a script (MAKE SURE HTTPSERVICE IS ENABLED!!) and put this in it!

while wait(15) do
    local String = game:GetService("HttpService"):GetAsync("URL HERE") -- Returns a string.
    if string.find(String,"id") then -- When you are not streaming there will be no "id" in the string.
        game.ServerStorage.YoutubeLive.Value = true -- Make a value in server storage, you can check from the client or something to show guis etc.
    else
	    game.ServerStorage.YoutubeLive.Value = false
    end
end

And thats it! Everything should work!

If it does not message me here on the fourms and I will try and help you!

  • I understood everything!
  • I wish there could be some more explaining…
  • I did not get this at all.

0 voters

4 Likes

Nice tutorial, but make sure to hide your key in the post so other people can’t mess with your app.

Also, what about the Twitch API? You mentioned it, and since this is a short tutorial, I think it’d better for everyone for this post to have some info too :wink:

2 Likes

Im actually not using that api key.

and I might do that tomorrow, got to go now tho.

2 Likes

Could you make an example of how to check if a channel is subscribed to another channel? Specifically an example of the part where it gets the table and analyzes it. Or maybe give me some tips? There aren’t any tutorials on YouTube for using the Google / YouTube API with Lua, and I’m sort of lost.