Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Scratch API get Total Follower Count
- -Snipet-
-
Scratcher
500+ posts
Scratch API get Total Follower Count
Basically what the title says. I know how to get the followers of a particular user, but it just shows a few. How do I get the total amount?
- _nix
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
There is no API for this (though they might add one eventually). For now the only way to get the follower count of a user is to parse the HTML to find the number on the user's /followers/ page.
- -Snipet-
-
Scratcher
500+ posts
Scratch API get Total Follower Count
There is no API for this (though they might add one eventually). For now the only way to get the follower count of a user is to parse the HTML to find the number on the user's /followers/ page.Oh yeah. I completely overlooked that. Thanks!

Last edited by -Snipet- (March 24, 2019 18:18:38)
- -Bonfire-
-
Scratcher
59 posts
Scratch API get Total Follower Count
You could make one yourselfThere is no API for this (though they might add one eventually). For now the only way to get the follower count of a user is to parse the HTML to find the number on the user's /followers/ page.Oh yeah. I completely overlooked that. Thanks!
- Movies22_by_TR
-
Scratcher
19 posts
Scratch API get Total Follower Count
There is no API for this (though they might add one eventually). For now the only way to get the follower count of a user is to parse the HTML to find the number on the user's /followers/ page.well, i tried doing that using node-fetch, but i got a empty response:
<html><head></head><body></body></html>
- _nix
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
Huh, that's really weird! It definitely didn't error like that for me in the past, and looking at the code for other libraries for interfacing with Scratch, I don't see anything different. (I tested myself and got the same response.)There is no API for this (though they might add one eventually). For now the only way to get the follower count of a user is to parse the HTML to find the number on the user's /followers/ page.well, i tried doing that using node-fetch, but i got a empty response:. How can i parse the HTML then?<html><head></head><body></body></html>
Apparently api.scratch.mit.edu still works fine, so you could try using that. It (still) doesn't have a follow count directly accessible anywhere, but you can calculate it by making repeated requests at different follower offsets to narrow in on the precise count.
E.g, make a number of requests like this:
- https://api.scratch.mit.edu/users/_nix/followers/?offset=0&limit=40 —
Response array length is full (40 items, max length for API) so there are more than 40 followers. - https://api.scratch.mit.edu/users/_nix/followers/?offset=40&limit=40 —
Length is 40 so there are more than 80 followers. - https://api.scratch.mit.edu/users/_nix/followers/?offset=80&limit=40 —
Length is 40 so there are more than 120 followers. - https://api.scratch.mit.edu/users/_nix/followers/?offset=160&limit=40 —
Length is 40 so there are more than 180 followers. - https://api.scratch.mit.edu/users/_nix/followers/?offset=320&limit=40 —
Length is 40 so there are more than 360 followers. - https://api.scratch.mit.edu/users/_nix/followers/?offset=640&limit=40 —
Length is 0 so there are less than 640 followers—we've overshot, so start counting down. Halfway between 360 and 640 is 500… - https://api.scratch.mit.edu/users/_nix/followers/?offset=500&limit=40 —
Length is 40 so there are more than 540 followers. Just count up from here since we must be pretty close. - https://api.scratch.mit.edu/users/_nix/followers/?offset=540&limit=40 —
Length is 8 so there are precisely 540 + 8 = 548 followers.
…Okay, so, 548 is more than what it says on my profile, but it is exactly what is shown when I delete my account (“You joined the Scratch community 5 years ago. You've created 907 projects and have 548 followers.”), so yaknow
(I think deleted accounts are included? I haven't researched this carefully.)I definitely didn't use the most generally efficient algorithm here, but in general this will always take at least a few requests (more for accounts with more followers), so make sure you're appropriately rate limiting yourself (like only making 5 requests a second for example). Otherwise you risk getting in trouble for overloading the Scratch APIs.
Last edited by _nix (Jan. 2, 2022 19:47:45)
- ScolderCreations
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
That makes sense, the reason is probably to prevent bots from spamming those pages with requests.
- Movies22_by_TR
-
Scratcher
19 posts
Scratch API get Total Follower Count
Well, there is no way to do it easly/fast. Because i was working in a live followers counter and I needed to get the followers count of every second.Huh, that's really weird! It definitely didn't error like that for me in the past, and looking at the code for other libraries for interfacing with Scratch, I don't see anything different. (I tested myself and got the same response.)There is no API for this (though they might add one eventually). For now the only way to get the follower count of a user is to parse the HTML to find the number on the user's /followers/ page.well, i tried doing that using node-fetch, but i got a empty response:. How can i parse the HTML then?<html><head></head><body></body></html>
Apparently api.scratch.mit.edu still works fine, so you could try using that. It (still) doesn't have a follow count directly accessible anywhere, but you can calculate it by making repeated requests at different follower offsets to narrow in on the precise count.
E.g, make a number of requests like this:
- https://api.scratch.mit.edu/users/_nix/followers/?offset=0&limit=40 —
Response array length is full (40 items, max length for API) so there are more than 40 followers.- https://api.scratch.mit.edu/users/_nix/followers/?offset=40&limit=40 —
Length is 40 so there are more than 80 followers.- https://api.scratch.mit.edu/users/_nix/followers/?offset=80&limit=40 —
Length is 40 so there are more than 120 followers.- https://api.scratch.mit.edu/users/_nix/followers/?offset=160&limit=40 —
Length is 40 so there are more than 180 followers.- https://api.scratch.mit.edu/users/_nix/followers/?offset=320&limit=40 —
Length is 40 so there are more than 360 followers.- https://api.scratch.mit.edu/users/_nix/followers/?offset=640&limit=40 —
Length is 0 so there are less than 640 followers—we've overshot, so start counting down. Halfway between 360 and 640 is 500…- https://api.scratch.mit.edu/users/_nix/followers/?offset=500&limit=40 —
Length is 40 so there are more than 540 followers. Just count up from here since we must be pretty close.- https://api.scratch.mit.edu/users/_nix/followers/?offset=540&limit=40 —
Length is 8 so there are precisely 540 + 8 = 548 followers.
…Okay, so, 548 is more than what it says on my profile, but it is exactly what is shown when I delete my account (“You joined the Scratch community 5 years ago. You've created 907 projects and have 548 followers.”), so yaknow(I think deleted accounts are included? I haven't researched this carefully.)
I definitely didn't use the most generally efficient algorithm here, but in general this will always take at least a few requests (more for accounts with more followers), so make sure you're appropriately rate limiting yourself (like only making 5 requests a second for example). Otherwise you risk getting in trouble for overloading the Scratch APIs.
- god286
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
Well, there is no way to do it easly/fast. Because i was working in a live followers counter and I needed to get the followers count of every second.Webscraping could be an option.
document.querySelector(".box-head > h2:nth-child(2)").innerText // me » Followers (12345)"
- Wetbikeboy2500
-
Scratcher
100+ posts
Scratch API get Total Follower Count
Well, there is no way to do it easly/fast. Because i was working in a live followers counter and I needed to get the followers count of every second.Webscraping could be an option.document.querySelector(".box-head > h2:nth-child(2)").innerText // me » Followers (12345)"
This is for the top of the followers page where it displays the total number of followers a user has. This makes it a single request.
You can then use some regex on it to extract the specific number
/\((\d+)\)/g.exec(document.querySelector('.box-head h2').innerText)[1]
Last edited by Wetbikeboy2500 (Jan. 4, 2022 19:58:31)
- coolcoder1213
-
Scratcher
100+ posts
Scratch API get Total Follower Count
ScratchDB offers the stats for the amount of followers you have but not the amount. You would have to web-scrape.
- MagicCrayon9342
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
You can simply grab it from the api directly. Using a CORS proxy.
Here's a list of them
A list inside a list.
Always online, fast, and free. I literally never update it, its just as cors-anywhere instance which you CAN host yourself.
Here's a list of them
A list inside a list.
Always online, fast, and free. I literally never update it, its just as cors-anywhere instance which you CAN host yourself.
- NFlex23
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
(#13)I don't think you read the OP carefully. You don't even need a proxy for the Scratch API anyway.
You can simply grab it from the api directly. Using a CORS proxy.
Here's a list of them
A list inside a list.
Always online, fast, and free. I literally never update it, its just as cors-anywhere instance which you CAN host yourself.
- MagicCrayon9342
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
You can do it manually but a CORS proxy is just easier.(#13)I don't think you read the OP carefully. You don't even need a proxy for the Scratch API anyway.
You can simply grab it from the api directly. Using a CORS proxy.
Here's a list of them
A list inside a list.
Always online, fast, and free. I literally never update it, its just as cors-anywhere instance which you CAN host yourself.
From a website you WILL need a CORS proxy or that manual method.

- Steve0Greatness
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
ScratchDB has a page for this:
this returns a JSON of info about the user in question. The total follower count is under the keys statistics, then followers.
https://scratchdb.lefty.one/v3/user/info/:user
- MagicCrayon9342
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
ScratchDB has a page for this:To clear some confusion, if you ever see a ‘:’ before a value in a URL of an express application that means that's a value to replace with the ‘user’ in this case. Not sure why everyone includes the colon as its only necessary in the code itself. Confused me at one point.this returns a JSON of info about the user in question. The total follower count is under the keys statistics, then followers.https://scratchdb.lefty.one/v3/user/info/:user
- NFlex23
-
Scratcher
1000+ posts
Scratch API get Total Follower Count
(#17)It's to show people that you replace it with an arbitrary value. If you didn't include the colon it would be even more confusing.ScratchDB has a page for this:To clear some confusion, if you ever see a ‘:’ before a value in a URL of an express application that means that's a value to replace with the ‘user’ in this case. Not sure why everyone includes the colon as its only necessary in the code itself. Confused me at one point.this returns a JSON of info about the user in question. The total follower count is under the keys statistics, then followers.https://scratchdb.lefty.one/v3/user/info/:user
- Discussion Forums
- » Advanced Topics
-
» Scratch API get Total Follower Count













