add scripts

This commit is contained in:
biglyderv 2024-09-19 02:49:56 -04:00
parent 11e325d25e
commit 51699134bc
No known key found for this signature in database
GPG key ID: 33AC87E9ACE66954
2 changed files with 68 additions and 0 deletions

31
download_tree.js Normal file
View file

@ -0,0 +1,31 @@
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)