Discuss Scratch

BowWhalley
Scratcher
100+ posts

Manipulate Cloud Data externally.

So I have seen a few cool projects that are controlled through cloud variables, which are controlled from an private computer/server.

I was wondering how I can get started into this and what may be required.

Last edited by BowWhalley (Oct. 31, 2015 13:01:43)



Check out my new WIP MAP. I need people to join - 9th March 2018
Please check out my new game, AppleCatch! - 8th March 2018
Profile picture made by @HelloUnicorns2

BowWhalley
Scratcher
100+ posts

Manipulate Cloud Data externally.

Bump.


Check out my new WIP MAP. I need people to join - 9th March 2018
Please check out my new game, AppleCatch! - 8th March 2018
Profile picture made by @HelloUnicorns2

DigiTechs
Scratcher
500+ posts

Manipulate Cloud Data externally.

Essentially, you'd need to do something like this in code:


Login with the desired username + password
Get the CSRF token
Send a request to get/set cloud data


Although, unlike other people, I don't know what the API endpoints are.

I do, in fact, have my own site; it's here.
I'm also working on a thing called Fetch. Look at it here!
@thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain.
WooHooBoy
Scratcher
1000+ posts

Manipulate Cloud Data externally.

BowWhalley
Scratcher
100+ posts

Manipulate Cloud Data externally.

ok, thanks . Now, how can I use the api? Should I use a JavaScript Script?


Check out my new WIP MAP. I need people to join - 9th March 2018
Please check out my new game, AppleCatch! - 8th March 2018
Profile picture made by @HelloUnicorns2

PullJosh
Scratcher
1000+ posts

Manipulate Cloud Data externally.

WooHooBoy wrote:

https://www.npmjs.com/package/scratch-api
Oh wow, I forgot that was a thing.

Come to think of it, wasn't there a python version at one point? Or is that just me…
BookOwl
Scratcher
1000+ posts

Manipulate Cloud Data externally.

PullJosh wrote:

WooHooBoy wrote:

https://www.npmjs.com/package/scratch-api
Oh wow, I forgot that was a thing.

Come to think of it, wasn't there a python version at one point? Or is that just me…
I wish… Python is WAY more stable than node

who needs signatures
PullJosh
Scratcher
1000+ posts

Manipulate Cloud Data externally.

BookOwl wrote:

PullJosh wrote:

WooHooBoy wrote:

https://www.npmjs.com/package/scratch-api
Oh wow, I forgot that was a thing.

Come to think of it, wasn't there a python version at one point? Or is that just me…
I wish… Python is WAY more stable than node
Someone should make that.
MathWizz
Scratcher
100+ posts

Manipulate Cloud Data externally.

BookOwl wrote:

Python is WAY more stable than node
Why do you say this…?

BowWhalley wrote:

ok, thanks . Now, how can I use the api? Should I use a JavaScript Script?
You need to install node.js and install the package with npm. Then you can write a JavaScript program to use the package and run it using node.

Last edited by MathWizz (Oct. 31, 2015 23:56:31)


running Chromium 42.0.2311.90 with Flash Player 15.0.0.189 on Arch Linux 3.19.5-1-ck
MathWizzJsScratch && sb.js & Amber (coming soon! maybe)
BowWhalley
Scratcher
100+ posts

Manipulate Cloud Data externally.

MathWizz wrote:

BookOwl wrote:

Python is WAY more stable than node
Why do you say this…?

BowWhalley wrote:

ok, thanks . Now, how can I use the api? Should I use a JavaScript Script?
You need to install node.js and install the package with npm. Then you can write a JavaScript program to use the package and run it using node.
Ok thankyou. I am running a mac, do you recommend any programs to write the code with?


Check out my new WIP MAP. I need people to join - 9th March 2018
Please check out my new game, AppleCatch! - 8th March 2018
Profile picture made by @HelloUnicorns2

BowWhalley
Scratcher
100+ posts

Manipulate Cloud Data externally.

bump


Check out my new WIP MAP. I need people to join - 9th March 2018
Please check out my new game, AppleCatch! - 8th March 2018
Profile picture made by @HelloUnicorns2

liam48D
Scratcher
1000+ posts

Manipulate Cloud Data externally.

BowWhalley wrote:

MathWizz wrote:

BookOwl wrote:

Python is WAY more stable than node
Why do you say this…?

BowWhalley wrote:

ok, thanks . Now, how can I use the api? Should I use a JavaScript Script?
You need to install node.js and install the package with npm. Then you can write a JavaScript program to use the package and run it using node.
Ok thankyou. I am running a mac, do you recommend any programs to write the code with?
Try Sublime Text.

It costs 70 dollars but you can download and use it for as long as you want for free, so long as you can deal with a popup that appears every 500 saves or whatever.

202e-202e-202e-202e-202e UNI-CODE~~~~~
BowWhalley
Scratcher
100+ posts

Manipulate Cloud Data externally.

liam48D wrote:

BowWhalley wrote:

MathWizz wrote:

BookOwl wrote:

Python is WAY more stable than node
Why do you say this…?

BowWhalley wrote:

ok, thanks . Now, how can I use the api? Should I use a JavaScript Script?
You need to install node.js and install the package with npm. Then you can write a JavaScript program to use the package and run it using node.
Ok thankyou. I am running a mac, do you recommend any programs to write the code with?
Try Sublime Text.

It costs 70 dollars but you can download and use it for as long as you want for free, so long as you can deal with a popup that appears every 500 saves or whatever.
Ok thankyou, I do not know how to run the script though. Also I am not sure how to save it with java script encoding as it is not listed by default.


Check out my new WIP MAP. I need people to join - 9th March 2018
Please check out my new game, AppleCatch! - 8th March 2018
Profile picture made by @HelloUnicorns2

WooHooBoy
Scratcher
1000+ posts

Manipulate Cloud Data externally.

BowWhalley wrote:

liam48D wrote:

BowWhalley wrote:

MathWizz wrote:

BookOwl wrote:

Python is WAY more stable than node
Why do you say this…?

BowWhalley wrote:

ok, thanks . Now, how can I use the api? Should I use a JavaScript Script?
You need to install node.js and install the package with npm. Then you can write a JavaScript program to use the package and run it using node.
Ok thankyou. I am running a mac, do you recommend any programs to write the code with?
Try Sublime Text.

It costs 70 dollars but you can download and use it for as long as you want for free, so long as you can deal with a popup that appears every 500 saves or whatever.
Ok thankyou, I do not know how to run the script though. Also I am not sure how to save it with java script encoding as it is not listed by default.
Just save it as main.js, and go to a command line and type
node main.js

considered harmful
robinp
Scratcher
100+ posts

Manipulate Cloud Data externally.

PullJosh wrote:

WooHooBoy wrote:

https://www.npmjs.com/package/scratch-api
Oh wow, I forgot that was a thing.

Come to think of it, wasn't there a python version at one point? Or is that just me…
I'm making one right now. Setting vars works right now but the CSRF token is giving me a headache

System Administrator | Portfolio | My Blog | Web Developer
PullJosh
Scratcher
1000+ posts

Manipulate Cloud Data externally.

robinp wrote:

PullJosh wrote:

WooHooBoy wrote:

https://www.npmjs.com/package/scratch-api
Oh wow, I forgot that was a thing.

Come to think of it, wasn't there a python version at one point? Or is that just me…
I'm making one right now. Setting vars works right now but the CSRF token is giving me a headache
Awesome! I hope it works out.
BowWhalley
Scratcher
100+ posts

Manipulate Cloud Data externally.

All is going well for me now but with the functions, it wants a callback I think it is called.

var Scratch = require('scratch-api');
console.log(Scratch.getProject(85635578))
returns this in console/terminal
undefined


Check out my new WIP MAP. I need people to join - 9th March 2018
Please check out my new game, AppleCatch! - 8th March 2018
Profile picture made by @HelloUnicorns2

liam48D
Scratcher
1000+ posts

Manipulate Cloud Data externally.

BowWhalley wrote:

All is going well for me now but with the functions, it wants a callback I think it is called.
var Scratch = require('scratch-api');
console.log(Scratch.getProject(85635578))
returns this in console/terminal
undefined

I've not used the API before but perhaps (this is a guess) Scratch.getProject takes a function as a callback?

I.e:
Scratch.getProject(..., function(data) {
console.log("Data loaded!");
console.log(data);
});

202e-202e-202e-202e-202e UNI-CODE~~~~~
PullJosh
Scratcher
1000+ posts

Manipulate Cloud Data externally.

liam48D wrote:

BowWhalley wrote:

All is going well for me now but with the functions, it wants a callback I think it is called.
var Scratch = require('scratch-api');
console.log(Scratch.getProject(85635578))
returns this in console/terminal
undefined

I've not used the API before but perhaps (this is a guess) Scratch.getProject takes a function as a callback?

I.e:
Scratch.getProject(..., function(data) {
console.log("Data loaded!");
console.log(data);
});
It seems so.
BowWhalley
Scratcher
100+ posts

Manipulate Cloud Data externally.

Replies, null and undefined.

var Scratch = require("scratch-api");
Scratch.getProject(85635578,function(data){
console.log("this is a test");
console.log(data);
});

Bowan:~ Rocketman2040$ node /Users/Rocketman2040/Desktop/Media/JavaScript/Bowan.js 
this is a test
null
Bowan:~ Rocketman2040$

Last edited by BowWhalley (Nov. 1, 2015 20:25:03)



Check out my new WIP MAP. I need people to join - 9th March 2018
Please check out my new game, AppleCatch! - 8th March 2018
Profile picture made by @HelloUnicorns2

Powered by DjangoBB