Discuss Scratch

chooper100
Scratcher
500+ posts

Automatically Find Out The Current FPC

Okay, so this isn't explicitly for a Scratch extension - it's actually for an extension to Google Chrome I'm developing to display the current / next curator. However, I thought this was probably a good place to ask for help.

Whilst the next fpc will probably have to be updated manually, I am confident that there is a way to find out the current FPC automatically.

My current plan is to load up the homepage and then inspect the DOM to find out the fpc, however this method is very slow.

What I am looking for is some kind of link to a Scratch API page that will report the username of the current FPC. This feature must exist in some form because how does the Scratch homepage find out if it doesn't?

So, does anyone know what this page is?

Edit:
Just to clarify, I am not worried if the API page gives extra information, eg. JSON formatting or HTML tags. As long as it contains the information somewhere I am fine

Last edited by chooper100 (Aug. 30, 2015 22:19:42)

Rumanti
Scratcher
1000+ posts

Automatically Find Out The Current FPC

I think the Advanced Topics forum would be more appropriate though
No API found yet
chooper100
Scratcher
500+ posts

Automatically Find Out The Current FPC

Yeah, I also posted a topic in the Advanced Topics forum (@Paddle2see* recommended both)
ScratchinJoJo
Scratcher
100+ posts

Automatically Find Out The Current FPC

I got a feeling it isn't loaded using AJAX, but rather through php (and a database), since I am able to see the curators name even when I turn off javascript.
chooper100
Scratcher
500+ posts

Automatically Find Out The Current FPC

Yep, that's what I think.

If the value was stored on a server, is it possible to connect to a server on a separate domain?
ScratchinJoJo
Scratcher
100+ posts

Automatically Find Out The Current FPC

yes and no

You can, if it allows remote connections, which is usually not the case for security reasons, but it could be possible since you are able to upload projects from the offline editor. But I could be completely wrong too and it could also be something through ftp so yeah

Also, to connect to a database, you'll need the password, and that's gonna be a real problem I think (unless you're a mastermind hacker off course)
chooper100
Scratcher
500+ posts

Automatically Find Out The Current FPC

Meh. Brute force will do it

Anyway, maybe a good idea would be to try asking the front-end developer for Scratch. I presume you don't know who that it so I'll ask Paddle2see if he knows
ScratchinJoJo
Scratcher
100+ posts

Automatically Find Out The Current FPC

Are you gonna load the home page with ajax? good luck! I tried it a moment ago, I got an error:

XMLHttpRequest cannot load http://scratch.mit.edu/. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.

I hope you still have other ideas?
Mrcomputer1
Scratcher
500+ posts

Automatically Find Out The Current FPC

ScratchinJoJo wrote:

I got a feeling it isn't loaded using AJAX, but rather through php (and a database), since I am able to see the curators name even when I turn off javascript.
Not php I think the site uses Django

ScratchinJoJo wrote:

Are you gonna load the home page with ajax? good luck! I tried it a moment ago, I got an error:

XMLHttpRequest cannot load http://scratch.mit.edu/. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.

I hope you still have other ideas?
Try http://crossorigin.me/https://scratch.mit.edu
ScratchinJoJo
Scratcher
100+ posts

Automatically Find Out The Current FPC

Mrcomputer1 wrote:

ScratchinJoJo wrote:

I got a feeling it isn't loaded using AJAX, but rather through php (and a database), since I am able to see the curators name even when I turn off javascript.
Not php I think the site uses Django
oh yeah, you're probably right, but that's still server side
ChocolatePi
Scratcher
1000+ posts

Automatically Find Out The Current FPC

Not everything has an API call. Some objects are just stored on the server and don't need anything to access from the client side. It's loaded as part of the server. Sometimes you just have to parse the HTML from the front-page and get it over with!

And please stop saying AJAX, people! It's not even a well-defined word! Plus, you don't need JavaScript on to make requests, some things are done by the server! Kids today…

Last edited by ChocolatePi (Oct. 6, 2015 11:53:33)

Scratcher1002
Scratcher
1000+ posts

Automatically Find Out The Current FPC

Btw, just saying, there is a studio about the next curator so you know:
Thing..
Just sayin'. :)
chooper100
Scratcher
500+ posts

Automatically Find Out The Current FPC

Scratcher1002 wrote:

Btw, just saying, there is a studio about the next curator so you know:
Thing..
Just sayin'. :)
Yes, I know about that - I'm one of the managers in that studio myself.

The project I am working on is in partnership with the creator of that studio, where I make the tool and he then keeps it updated.
chooper100
Scratcher
500+ posts

Automatically Find Out The Current FPC

Just to provide some closure to this topic, I found out there is actually a way to find out the current curator without a complete full-blown load of the home page.

If we look at the Scratch API page https://api.scratch.mit.edu/proxy/featured, we get a list of data about the projects on the front page. A quick control+f of the current curator's name shows that for each of the curated projects, there is a property called ‘curator_name’ which holds the name of the current FPC.

(I do have working code that finds and returns the current FPC username from this, but I'm not sure whether I'm allowed to share it here.)

Anyway, I guess this issue is solved now so I'll close the topic.
Feel free to contact me on my profile if you want to talk any more about this.

Powered by DjangoBB