Discuss Scratch

Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

The server of this API is stopped permanently. The endpoints below won't work. Read this.


SUI v5.0 - The Scratch Username Index API


Indexer API for the user accounts on Scratch! This API can be used to find usernames from their IDs.

Currently, SUI has indexed 9.0M+ (9.0 Million) users! (As of 15 Aug, 2024)

Note: This API is slow at indexing and not all the users on Scratch have been indexed yet. This is due to limitations of the official Scratch API which allows a maximum of 10 requests per 1 second and the limitations of the hosting provider

The source code is on Github

Interactive Docs:

Interactive documentation can be found at: https://sui.scratchconnect.eu.org/docs

Indexing Methods/Types:

1. Username Indexer: This Indexer indexes the first 40 followers and following of all the followers of the first 100 most popular users on Scratch
2. Studio Members Indexer: This Indexer indexes the host, members and curators (and their first 40 following and followers) of the studios on Scratch
3. Project Creator Indexer: This Indexer indexes the creators (and their first 40 following and followers) of projects on Scratch starting from project ID 104
4. Short Usernames Indexer: This Indexer indexes the pre-generated 3-letter short usernames (and their first 40 followers and following) on Scratch
5. Forum Post User Indexer: This Indexer indexes the usernames from forum posts in the Scratch Forums
6. Cloud Game Username Indexer: This Indexer indexes the usernames from the cloud data of some selected (popular cloud projects) projects pre-added to the Scratch studio: 34001844
7. User Comments Author Indexer: This Indexer indexes the users from top 5 comments on top 5 popular Scratch users' profiles
8. Front Paged Project Creator Indexer: This Indexer indexes the creators of the front-paged projects on Scratch's front page

Out of the above indexing methods, only the 1st, 2nd and 3rd indexers are primary indexers which contribute a lot to the API while the others were added just to get more and unique usernames

Drawbacks:

1. The indexing is very slow and takes time
2. Not all the users on Scratch are indexed
3. Although this API can update the data of a frequently occurring user, some of the data stored in the server can be out-dated and this API may show the ID and username of those accounts which are deleted on Scratch

API Endpoints:

Root
GET https://sui.scratchconnect.eu.org/

Status
This endpoint will give the status and other information about the server like the total number of users indexed, the index or the famous user the API is currently indexing, etc.
GET https://sui.scratchconnect.eu.org/status/

Get ID (from username)
Note: Use the Scratch API to get the ID of a user. Some user's data may not have been indexed… This endpoint was made just for testing…
GET https://sui.scratchconnect.eu.org/get_id/:username
Example: https://sui.scratchconnect.eu.org/get_id/griffpatch

Get User (from ID)
Use this endpoint to get the username of the Scratch user from a ID
GET https://sui.scratchconnect.eu.org/get_user/:id
Example: https://sui.scratchconnect.eu.org/get_user/1882674

Get Random Data
Get the random indexed data
GET https://sui.scratchconnect.eu.org/random/

Get Data
To get the data, use the "/get_data: endpoint. Eg.:
GET https://sui.scratchconnect.eu.org/get_data/?limit=100&offset=0
The “limit” parameter states the number of indexed data you want (max limit of 10K) and the “offset” parameter states the number of data you want to skip from the beginning. This is similar as used in the Scratch API.

A big thanks to:

Note for Scratch Team:

If the SUI API is spamming the Scratch API then I will discontinue running it or reduce the number of requests made. Just comment me on my Scratch Profile (Account: @Sid72020123) or open an issue on Github. Currently, it makes 3-4 requests per 1 second.

Thank You!

Project created and maintained by @Sid72020123 on Scratch

Last edited by Sid72020123 (Sept. 9, 2024 12:52:06)

Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

BUMP
-EmeraldThunder-
Scratcher
1000+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

I've always wanted something that allows you to do this! I can think of several projects I've dropped because of this.
What crawling algorithm have you used?
Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

-EmeraldThunder- wrote:

I've always wanted something that allows you to do this! I can think of several projects I've dropped because of this.
What crawling algorithm have you used?
This just takes all the followers of famous users in Scratch. Then it collects the data of 40 followers of those followers…
After some time, I may add some new technique…
Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

BUMP
mbrick2
Scratcher
1000+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

Could you add more information such as join date and status (scratcher, teacher, student)

Last edited by mbrick2 (Feb. 17, 2022 09:46:11)

Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

mbrick2 wrote:

Could you add more information such as join date and status (scratcher, teacher, student)
I could have done that but that would increase the size of data stored of each user…
But still you can request to Scratch API or Scratch DB to get that information…
Chiroyce
Scratcher
1000+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

I think @Jeffalo was working on something related to this.
Chiroyce
Scratcher
1000+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

Suggestion for the get_id endpoint - use requests to get it from the Scratch API.

If the user is Chiroyce, get the JSON data from https://api.scratch.mit.edu/users/Chiroyce/
Here's a demo
from requests import get
def get_id(username):
    id = get(f'https://api.scratch.mit.edu/users/{username}').json()['id']
    return id
Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

Chiroyce wrote:

Suggestion for the get_id endpoint - use requests to get it from the Scratch API.

If the user is Chiroyce, get the JSON data from https://api.scratch.mit.edu/users/Chiroyce/
Here's a demo
from requests import get
def get_id(username):
    id = get(f'https://api.scratch.mit.edu/users/{username}').json()['id']
    return id
I know that already but I made it so that I could have checked if the specific user is indexed…
I also wrote in the docs above.
Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

Shall I add ‘all_data’ endpoint? What do you think? People may spam it but I may add API keys for that…
mbrick2
Scratcher
1000+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

Sid72020123 wrote:

(#11)
Shall I add ‘all_data’ endpoint? What do you think? People may spam it but I may add API keys for that…
YES PLEASE

Last edited by mbrick2 (Feb. 17, 2022 10:52:35)

Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

mbrick2 wrote:

Sid72020123 wrote:

(#11)
Shall I add ‘all_data’ endpoint? What do you think? People may spam it but I may add API keys for that…
YES PLEASE
I am busy now because of school and my exams are gonna start soon…
I will think over this and I will make that endpoint…
god286
Scratcher
1000+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

all data should have a rate limit and only return 10-20 at a time
Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

god286 wrote:

all data should have a rate limit and only return 10-20 at a time
Yes. I may add that…
mbrick2
Scratcher
1000+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

Where is the source code?
Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

mbrick2 wrote:

Where is the source code?
Currently, the source code is on replit
I will add it to github soon…
mbrick2
Scratcher
1000+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

Sid72020123 wrote:

(#17)

mbrick2 wrote:

Where is the source code?
Currently, the source code is on replit
I will add it to github soon…
THROWS an error
Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

mbrick2 wrote:

Sid72020123 wrote:

(#17)

mbrick2 wrote:

Where is the source code?
Currently, the source code is on replit
I will add it to github soon…
THROWS an error
It should give an error because the password is stored in environment variable and you can't access it… but still you can see the source code and the program is still running…
Sid72020123
Scratcher
500+ posts

[Servers Stopped!] SUI v5.0 - Scratch Username Index API

mbrick2 wrote:

Sid72020123 wrote:

(#17)

mbrick2 wrote:

Where is the source code?
Currently, the source code is on replit
I will add it to github soon…
THROWS an error
Oh wait… It's Scratch's URL Error
Correct Link:
https://replit.com/@Sid72020123/SUI?v=1

Powered by DjangoBB