How can I make a realtime YouTube subscriber count?

ye it is kinda strange, considering through this code using the google api:

local http = game:GetService('HttpService')

local api_key = ''--api key
local channel_id = 'UCs6yDXwXuKeLoz0d87Uhosg'
local url = 'https://www.googleapis.com/youtube/v3/channels?part=statistics&id='..channel_id..'&key='..api_key

local success,data = pcall(function()
	return http:GetAsync(url)
end)

if data then
	local decoded = http:JSONDecode(data)
	local subs = decoded['items'][1]['statistics']['subscriberCount']
end

you only get an estimate, this returns 55700

1 Like

Unfortunately, this method did not stand the test of time. While it is incredibly good at guessing, it’s not perfect.

As a result, the subscriber count is slightly off.

This will become significantly more noticeable when I’m streaming – as I gain subscribers 15x faster.
The sub count would lag behind a lot.

Nonetheless, this was a really close solution!

Edit: Looks like our only option is web scraping.

1 Like

I’m pretty sure there is no possible solution for finding the exact amount, I tried looking through youtubes requests but they return everything abbreviated. Also, where would you webscrape the exact value from?

1 Like

Youtube Studio has a window where I’m able to view my subscribers in real time.


If anyone can figure out how to extract the numbers from this screen and apply them in-game, I will happily pay in Robux.

Edit: I understand that this will most likely require web scraping and non-lua coding languages.

1 Like

I don’t mind writing up some code for you no cost, just give me a lot of minutes.

2 Likes

I’m sorry I was pretty ambiguous when I stated the thing about breaking the TOS. What I meant was that, in general, when a company gives you an API, they make web scraping that data a violation of the TOS. So you wouldn’t be breaking Roblox TOS, just Youtube’s (most likely). Though hey, Youtube most likely doesn’t care and they most likely won’t stop you. It’s just good to know.

1 Like