Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I upload projects using Scratchattach? #152

Closed
NumbersTada opened this issue Oct 29, 2023 · 15 comments
Closed

How do I upload projects using Scratchattach? #152

NumbersTada opened this issue Oct 29, 2023 · 15 comments
Labels
enhancement New feature or request

Comments

@NumbersTada
Copy link

can you give me some help?

@TimMcCool
Copy link
Owner

TimMcCool commented Oct 29, 2023

You can use

project = session.connect_project("PROJECTID")
project.set_json(json_data)

to change the project JSON of a project.

@NumbersTada
Copy link
Author

NumbersTada commented Oct 29, 2023

That worked for an already existing project, but how do I create a new project?

@TimMcCool
Copy link
Owner

You can't create new projects with scratchattach

@TimMcCool TimMcCool added the question Further information is requested label Oct 29, 2023
@NumbersTada
Copy link
Author

OK

@NumbersTada
Copy link
Author

Also, is it possible to fetch all projects of an user at once?

@RC9910-Scratch
Copy link
Contributor

user.projects(limit=None, offset=0) -> this returns all the shared projects of a user as scratch3.Project objects

@NumbersTada
Copy link
Author

That only returns the first 20 projects

@gamecraft312
Copy link

That worked for an already existing project, but how do I create a new project?

you can use:
import webbrowser

webbrowser.open_new_tab(https://scratch.mit.edu/projects/editor/) #this will make the ID and generate a new project

@Leaderofepic134
Copy link

You can't create new projects with scratchattach

will this ever happen?

@TimMcCool
Copy link
Owner

You can't create new projects with scratchattach

will this ever happen?

Maybe

@TimMcCool TimMcCool added enhancement New feature or request and removed question Further information is requested labels Feb 27, 2024
@Waakul
Copy link

Waakul commented Jun 20, 2024

you can send a request to https://scratch.mit.edu/projects/editor/ . I'm not sure how to get its id tho. You'll have to a list of your project from an API and check the id of the latest one.

@Waakul
Copy link

Waakul commented Jun 20, 2024

you could get the id using bs4 in "https://scratch.mit.edu/mystuff/" with all your cookies i believe, the link to it is in the a tag of the top most project. you could parse the id out of it.

@TheCommCraft
Copy link
Collaborator

TheCommCraft commented Jun 20, 2024

You need to do a post request to https://projects.scratch.mit.edu/ and get "content-name" from the response.

Example(not guarranteed to work):

import requests

session = ... # Create your session here

response = requests.post("https://projects.scratch.mit.edu/", headers=session._headers, cookies=session._cookies)
project_id = int(response.json()["content-name"])

@namtacs
Copy link
Contributor

namtacs commented Jun 21, 2024

Look and discuss api here towerofnix/scratch-api-unofficial-docs#37

Also, I am currently making a giant fork (for now private) that is a rework of scratchattach. Eventually, i will merge it (prob split). I can implement that easily.

@TimMcCool
Copy link
Owner

This is implemented in scratchattach 2.0 (will be released next week).
#242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants