31 lines
No EOL
793 B
JavaScript
31 lines
No EOL
793 B
JavaScript
var tree = [], gek, the;
|
|
|
|
function downloadURI(uri, name) {
|
|
var link = document.createElement("a");
|
|
link.download = name;
|
|
link.href = uri;
|
|
link.click();
|
|
}
|
|
|
|
async function downloadTree(id = "945859211") {
|
|
tree = await fetch("https://scratch.mit.edu/projects/"+id+"/remixtree/bare");
|
|
tree = await tree.json();
|
|
gek = tree.root_id;
|
|
}
|
|
|
|
async function getPoject() {
|
|
if (the != gek) {
|
|
e = await fetch("https://api.scratch.mit.edu/projects/"+the);
|
|
e = await e.json();
|
|
if (e.project_token != undefined) {
|
|
downloadURI("https://projects.scratch.mit.edu/"+the+"?token="+e.project_token, the)
|
|
}
|
|
the = tree[the].parent_id
|
|
} else {
|
|
console.log("end");
|
|
}
|
|
}
|
|
|
|
await downloadTree();
|
|
|
|
setInterval(getPoject, 500) |