Discuss Scratch

Wetbikeboy2500
Scratcher
100+ posts

SB2Downloader

So good old infinitytec asked to get a .sb2 downloader for Scratch projects added to a certain userscript. I then went on the treacherous path of finding one already made but it doesn't work right. So after spending 3 hours on that, I decided to build my own. I have worked with the Scratch api before with the Scratch Browser but this was a mess. You first have to get the json for the project and all the asset file names, but each asset is named with a number that links to the file in the .sb2. The problem is though when you get the json file from the Scratch api all the ids are -1, not very useful. I then had to determine how it parsed the data in order to generate the correct ids to link to the correct files while also modify the json to not have the ids of -1. There is also some smaller stuff like layerPenID is always 0 and that repeats of the same file use the same id which just makes everything more difficult. I then requested all the sounds and costumes since I had gotten their names and put all the files together with JSZip. The final part was to get the project name with just the id but that link seems to work sometimes and not work sometimes. That is why if you are downloading a project the default name is used since their is no reliable way to get the project name without having to use the username associated with it. That is pretty much how the whole program works. It is up on GitHub if you want to help with it or use it for your own stuff.

SB2Downloader Webpage

GitHub Repository



Last edited by Wetbikeboy2500 (March 19, 2018 01:29:49)


Scratch Made In JavaScript: https://scratch.mit.edu/discuss/topic/171842
Scratch Browser: https://scratch.mit.edu/discuss/topic/285957/
SB2Downloader: https://scratch.mit.edu/discuss/topic/295425/
Multiple work stations: https://scratch.mit.edu/discuss/topic/122484/
New Blocks for Displaying Text: https://scratch.mit.edu/discuss/topic/171508
Sprite Folders: https://scratch.mit.edu/discuss/topic/171569/
Find code easier: https://scratch.mit.edu/discuss/topic/144748/
A Support Button or No support Button: https://scratch.mit.edu/discuss/topic/181154/
I want Scratch grow and become a better place for everyone to come and use. So Scratch needs to expand and have more options for everyone.Scratch needs to break the boundaries and not be trapped by what is familiar to Scratch community
NitroCipher
Scratcher
500+ posts

SB2Downloader

Sweet! Did you run a checker to see if the project files (from the editor, and from your thing) are identical?

I hope my post helped you in some way! Post count: 500+

Current project: [s3Blocks: scratchblocks rewritten for Scratch 3.0] ::#4b4a60 //https://scratch.mit.edu/discuss/topic/290031/ Basically done!
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
Wetbikeboy2500
Scratcher
100+ posts

SB2Downloader

NitroCipher wrote:

Sweet! Did you run a checker to see if the project files (from the editor, and from your thing) are identical?
I actually compared the decompressed file against each other. The only difference is that my .json file is minified while the other one isn't.





Scratch Made In JavaScript: https://scratch.mit.edu/discuss/topic/171842
Scratch Browser: https://scratch.mit.edu/discuss/topic/285957/
SB2Downloader: https://scratch.mit.edu/discuss/topic/295425/
Multiple work stations: https://scratch.mit.edu/discuss/topic/122484/
New Blocks for Displaying Text: https://scratch.mit.edu/discuss/topic/171508
Sprite Folders: https://scratch.mit.edu/discuss/topic/171569/
Find code easier: https://scratch.mit.edu/discuss/topic/144748/
A Support Button or No support Button: https://scratch.mit.edu/discuss/topic/181154/
I want Scratch grow and become a better place for everyone to come and use. So Scratch needs to expand and have more options for everyone.Scratch needs to break the boundaries and not be trapped by what is familiar to Scratch community
infinitytec
Scratcher
1000+ posts

SB2Downloader

Nice! Works well!
Thanks for adding it!


Not here much, but sometimes I lurk.
God has a plan. He has a plan for everything, and everyone.
Wetbikeboy2500
Scratcher
100+ posts

SB2Downloader

infinitytec wrote:

Nice! Works well!
Thanks for adding it!
No problem





Scratch Made In JavaScript: https://scratch.mit.edu/discuss/topic/171842
Scratch Browser: https://scratch.mit.edu/discuss/topic/285957/
SB2Downloader: https://scratch.mit.edu/discuss/topic/295425/
Multiple work stations: https://scratch.mit.edu/discuss/topic/122484/
New Blocks for Displaying Text: https://scratch.mit.edu/discuss/topic/171508
Sprite Folders: https://scratch.mit.edu/discuss/topic/171569/
Find code easier: https://scratch.mit.edu/discuss/topic/144748/
A Support Button or No support Button: https://scratch.mit.edu/discuss/topic/181154/
I want Scratch grow and become a better place for everyone to come and use. So Scratch needs to expand and have more options for everyone.Scratch needs to break the boundaries and not be trapped by what is familiar to Scratch community

Powered by DjangoBB