Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)
- ScratchcatandGobo
-
1000+ posts
scratchattach - A Scratch API wrapper (Python)
Is there any ways to check if a user does or does not exist?
Yeah, but at least we've learned something today… that every moment of our life should be lived to the fullest because it can be very long or very short, my friend. - Gumball
I felt like I wanted to develop games on here, so I won't leave! (for now)
(last edited 2/8/24)
- infintyrussia
-
100+ posts
scratchattach - A Scratch API wrapper (Python)
Try this: Is there any ways to check if a user does or does not exist?
https://api.scratch.mit.edu/accounts/checkusername/USERNAME_HERE
- ScratchcatandGobo
-
1000+ posts
scratchattach - A Scratch API wrapper (Python)
nvm, maybeTry this: Is there any ways to check if a user does or does not exist?
https://api.scratch.mit.edu/accounts/checkusername/USERNAME_HERE
Last edited by ScratchcatandGobo (April 28, 2024 20:48:43)
Yeah, but at least we've learned something today… that every moment of our life should be lived to the fullest because it can be very long or very short, my friend. - Gumball
I felt like I wanted to develop games on here, so I won't leave! (for now)
(last edited 2/8/24)
- AwesomePeopleOutTher
-
22 posts
scratchattach - A Scratch API wrapper (Python)
Can I look up users with scratchattach based on their id. What I want to do is generate a random id and then find the user data correlating to the id.
![](https://cdn2.scratch.mit.edu/get_image/user/57845141_32x32.png)
- TheCommCraft
-
500+ posts
scratchattach - A Scratch API wrapper (Python)
(#2425)It's not possible, the scratch api doesn't allow it
Can I look up users with scratchattach based on their id. What I want to do is generate a random id and then find the user data correlating to the id.
- davidtheplatform
-
500+ posts
scratchattach - A Scratch API wrapper (Python)
You can use Can I look up users with scratchattach based on their id. What I want to do is generate a random id and then find the user data correlating to the id.SUI
Generation 4: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
- Sid72020123
-
500+ posts
scratchattach - A Scratch API wrapper (Python)
You can use Can I look up users with scratchattach based on their id. What I want to do is generate a random id and then find the user data correlating to the id.SUI
You can use the “/random” endpoint of the SUI API instead of generating a random ID and then getting the user. But the “/random” endpoint is very slow. So don't spam it.
Sometimes, the username returned may be deleted because the API doesn't delete the data of deleted usernames.
Sid72020123
- AwesomePeopleOutTher
-
22 posts
scratchattach - A Scratch API wrapper (Python)
How do I reply to a studio comment?
![](https://cdn2.scratch.mit.edu/get_image/user/57845141_32x32.png)
- Him_is_bob
-
71 posts
scratchattach - A Scratch API wrapper (Python)
How do scratch3.Project objects work? and how can i get ids
when green flag clicked
if <cool scratcher :: sensing> then{
tell (username) [In a remaster race Go check out the original https://scratch.mit.edu/projects/644148324/] :: looks
} elif <uncool::sensing>{
tell (username) [Looking at my projects will make you cooler.....] :: looks
} :: control
Im sorry i had a bigger evil kumquat but it got eaten by a good signature :: #FFA500
- MonkeyBean2
-
100+ posts
scratchattach - A Scratch API wrapper (Python)
If I wanted to get the full project data sprites costumes everything how would I download? Also for uploading. I am building a scratch android app and these are crucial features
Here's my project download script:
import requests, json from zipfile import ZipFile from os import path def download(id, destination=''): def getProjectJson(id): url = "https://projects.scratch.mit.edu/" + id return requests.get(url, allow_redirects=True).content def getAset(md5ext): url = "https://assets.scratch.mit.edu/internalapi/asset/"+md5ext+"/get/" response = requests.get(url, allow_redirects=True).content return response def packageZip(id, mainJson, assets): dest = destination if dest == '' or path.isdir(dest): dest += f'{id}.sb3' with ZipFile(dest, 'w') as zip: zip.writestr("project.json", mainJson) for asset in assets: # print("packaging "+asset['name']+"...") zip.writestr(asset['name'], asset['data']) def download_whole_project(id): print(f"downloading {id}...") url = f"https://projects.scratch.mit.edu/{id}" mainJson = requests.get(url, allow_redirects=True).content assets = getAsets(json.loads(str(mainJson.decode()))) print("packaging zip...") packageZip(id, mainJson, assets) def getAsets(mainJson): assets = [] urls = [] targets = mainJson['targets'] for target in targets: costumes = target['costumes'] sounds = target['sounds'] for costume in costumes: urls.append(costume['md5ext']) for sound in sounds: urls.append(sound['md5ext']) urls = list(set(urls)) print("getting assets...") for url in urls: print(url) assets.append({"data": getAset(url), "name": url}) return assets download_whole_project(id)
Last edited by MonkeyBean2 (April 30, 2024 18:56:26)
- SHARKEE_7
-
22 posts
scratchattach - A Scratch API wrapper (Python)
Thanks so much for practically saving my life.
Amazing API!
![](http://cdn.scratch.mit.edu/scratchr2/static/__74e70580e9dbe93ce1c3f8422dde592d__/djangobb_forum/img/smilies/big_smile.png)
——-7——-
#2432May 1, 2024 01:39:32
- mehonje
-
5 posts
scratchattach - A Scratch API wrapper (Python)
I can't even get scratchattach to import. I used the pip install scratchattach to install it, but when I try to import it, it says
PS C:\Users\admin\Desktop\python_work> & C
Users/admin/AppData/Local/Microsoft/WindowsApps/python3.12.exe c
Users/admin/Desktop/python_work/scratchattach_test_1
Traceback (most recent call last):
File “c:\Users\admin\Desktop\python_work\scratchattach_test_1”, line 1, in <module>
import scratchattach as scratch3
ModuleNotFoundError: No module named ‘scratchattach’
PS C:\Users\admin\Desktop\python_work>
Am I doing something wrong? I've been on every Github, Replit, and scratch pages I could find about scratchattach, and I couldn't find anything wrong with my code. All it is is
import scratchattach as scratch3
Please help!
PS C:\Users\admin\Desktop\python_work> & C
![](http://cdn.scratch.mit.edu/scratchr2/static/__74e70580e9dbe93ce1c3f8422dde592d__/djangobb_forum/img/smilies/hmm.png)
![](http://cdn.scratch.mit.edu/scratchr2/static/__74e70580e9dbe93ce1c3f8422dde592d__/djangobb_forum/img/smilies/hmm.png)
Traceback (most recent call last):
File “c:\Users\admin\Desktop\python_work\scratchattach_test_1”, line 1, in <module>
import scratchattach as scratch3
ModuleNotFoundError: No module named ‘scratchattach’
PS C:\Users\admin\Desktop\python_work>
Am I doing something wrong? I've been on every Github, Replit, and scratch pages I could find about scratchattach, and I couldn't find anything wrong with my code. All it is is
import scratchattach as scratch3
Please help!
#2433May 1, 2024 10:24:36
#2434May 1, 2024 11:11:33
- fiosjeofo
-
10 posts
scratchattach - A Scratch API wrapper (Python)
It's not favorates, it's favourites How do I make this get back the number of favs on a project?
This is what I have so far:import scratchattach as scratch3
session = scratch3.login("MineCodr", "1234567 <— #lol this isn’t my real password obviously")
conn = session.connect_cloud(project_id="706531701")
client = scratch3.CloudRequests(conn) #optional argument: ignore_exceptions=True
@client.request
def ping():
print("Ping request received")
return "project.favorates"
client.run()
Maybe that's why you code doesn't work
also, you have got it in speech marks in the line that says return “project.favorates” that means that when ping() runs it will output the text “project.favorates”, not the actual number of favourites
when green flag clicked
forever
keep coding
have fun
scratch on!
end
define scratch(attach v)
(is cool v)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<(hi)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#2435May 1, 2024 11:12:33
- fiosjeofo
-
10 posts
scratchattach - A Scratch API wrapper (Python)
what hosting does everyone use? i use bot-hosting.net, but it's annoying to keep adding coins.
Last edited by fiosjeofo (May 1, 2024 11:12:52)
when green flag clicked
forever
keep coding
have fun
scratch on!
end
define scratch(attach v)
(is cool v)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<(hi)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#2436May 1, 2024 11:13:56
- fiosjeofo
-
10 posts
scratchattach - A Scratch API wrapper (Python)
what is your code? (don't share your sessionid/password) I can't even get scratchattach to import. I used the pip install scratchattach to install it, but when I try to import it, it says
PS C:\Users\admin\Desktop\python_work> & CUsers/admin/AppData/Local/Microsoft/WindowsApps/python3.12.exe c
Users/admin/Desktop/python_work/scratchattach_test_1
Traceback (most recent call last):
File “c:\Users\admin\Desktop\python_work\scratchattach_test_1”, line 1, in <module>
import scratchattach as scratch3
ModuleNotFoundError: No module named ‘scratchattach’
PS C:\Users\admin\Desktop\python_work>
Am I doing something wrong? I've been on every Github, Replit, and scratch pages I could find about scratchattach, and I couldn't find anything wrong with my code. All it is is
import scratchattach as scratch3
Please help!
when green flag clicked
forever
keep coding
have fun
scratch on!
end
define scratch(attach v)
(is cool v)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<(hi)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#2437May 1, 2024 13:26:21
- Him_is_bob
-
71 posts
scratchattach - A Scratch API wrapper (Python)
its an issue i ran into with vscode. you have to install it through the terminal my using pip install scratchattatchwhat is your code? (don't share your sessionid/password) I can't even get scratchattach to import. I used the pip install scratchattach to install it, but when I try to import it, it says
PS C:\Users\admin\Desktop\python_work> & CUsers/admin/AppData/Local/Microsoft/WindowsApps/python3.12.exe c
Users/admin/Desktop/python_work/scratchattach_test_1
Traceback (most recent call last):
File “c:\Users\admin\Desktop\python_work\scratchattach_test_1”, line 1, in <module>
import scratchattach as scratch3
ModuleNotFoundError: No module named ‘scratchattach’
PS C:\Users\admin\Desktop\python_work>
Am I doing something wrong? I've been on every Github, Replit, and scratch pages I could find about scratchattach, and I couldn't find anything wrong with my code. All it is is
import scratchattach as scratch3
Please help!
when green flag clicked
if <cool scratcher :: sensing> then{
tell (username) [In a remaster race Go check out the original https://scratch.mit.edu/projects/644148324/] :: looks
} elif <uncool::sensing>{
tell (username) [Looking at my projects will make you cooler.....] :: looks
} :: control
Im sorry i had a bigger evil kumquat but it got eaten by a good signature :: #FFA500
#2438May 1, 2024 13:36:51
- TheCommCraft
-
500+ posts
scratchattach - A Scratch API wrapper (Python)
(#2436)https://scratch.mit.edu/discuss/topic/753178
what hosting does everyone use? i use bot-hosting.net, but it's annoying to keep adding coins.
#2439May 2, 2024 12:34:16
- MysticalSk1ttle
-
8 posts
scratchattach - A Scratch API wrapper (Python)
is it possible to automatically comment? I'm trying to inform all of the competitiors in my contest that the results are out. I also need to do the same with the prize givers because there's 89 of them
when green flag clicked
broadcast [I'm epic v]
when I receive [ I'm epic v]
ask [a random person," Am I Epic?"] and wait
if <(answer) = [yes]> then
switch costume to [happy v]
say [I know I am]
think [I'm glad he/she was an honest person]
else
if <(answer) = [no]> then
switch costume to [angry v]
say [How Dare You Lie To My Face!]
think [What A Jerk, Lying To My Face Like That]
#2440May 2, 2024 12:58:03
- nexoalex
-
77 posts
scratchattach - A Scratch API wrapper (Python)
bro I just downloaded the source code at the GitHub and extracted the zip then ran pip install scratchattach in command prompt or “terminal” tell me what os you have please so I can help further I can't even get scratchattach to import. I used the pip install scratchattach to install it, but when I try to import it, it says
PS C:\Users\admin\Desktop\python_work> & CUsers/admin/AppData/Local/Microsoft/WindowsApps/python3.12.exe c
Users/admin/Desktop/python_work/scratchattach_test_1
Traceback (most recent call last):
File “c:\Users\admin\Desktop\python_work\scratchattach_test_1”, line 1, in <module>
import scratchattach as scratch3
ModuleNotFoundError: No module named ‘scratchattach’
PS C:\Users\admin\Desktop\python_work>
Am I doing something wrong? I've been on every Github, Replit, and scratch pages I could find about scratchattach, and I couldn't find anything wrong with my code. All it is is
import scratchattach as scratch3
Please help!
Hello i am teh epik duck coder
YT: https://www.youtube.com/channel/UCCZqvGQ8D5mZ5l4ls6jEFMg
WEBSITE: https://nexoalex.w3spaces.com