attempt to extrapolate what the extra remixes are
This commit is contained in:
parent
b664acd1e2
commit
710d9d49c2
1 changed files with 13 additions and 7 deletions
18
js/app.js
18
js/app.js
|
@ -3,10 +3,7 @@ let entries = [];
|
||||||
let users = {};
|
let users = {};
|
||||||
|
|
||||||
let fetchData;
|
let fetchData;
|
||||||
|
async function genTree(treeId) {
|
||||||
async function genTree(treeId, tree2) {
|
|
||||||
fetchData = fetchData || await fetch(`https://scratch.mit.edu/projects/${tree2}/remixtree/bare/`)
|
|
||||||
.then(x => x.json());
|
|
||||||
|
|
||||||
entries.push(treeId)
|
entries.push(treeId)
|
||||||
let entry = fetchData[treeId];
|
let entry = fetchData[treeId];
|
||||||
|
@ -27,9 +24,18 @@ async function genTree(treeId, tree2) {
|
||||||
let doThings = false;
|
let doThings = false;
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
fetchData = await fetch(`https://scratch.mit.edu/projects/1052168454/remixtree/bare/`).then(x => x.json());
|
||||||
|
|
||||||
let latestData = await fetch("https://corsproxy.io/?https://api.scratch.mit.edu/studios/34493018/projects").then(x => x.json());
|
let latestData = await fetch("https://corsproxy.io/?https://api.scratch.mit.edu/studios/34493018/projects").then(x => x.json());
|
||||||
await genTree(latestData[0].id, "1052168454"); // latest project
|
|
||||||
await genTree("654605857", "1052168454"); // tree bug here, unavoidable without jank
|
let lid = latestData[0].id;
|
||||||
|
while (fetchData[lid].children.length > 0) {
|
||||||
|
let ch = fetchData[lid].children;
|
||||||
|
let ch2 = ch.filter(x => fetchData[x].children.length > 0);
|
||||||
|
lid = ch2[0] || ch[0];
|
||||||
|
}
|
||||||
|
await genTree(lid); // latest project
|
||||||
|
await genTree("654605857"); // tree bug here, unavoidable without jank
|
||||||
doThings = true;
|
doThings = true;
|
||||||
document.querySelector('.contributors').innerHTML = Object.keys(users)
|
document.querySelector('.contributors').innerHTML = Object.keys(users)
|
||||||
.sort((x, y) => users[y] - users[x])
|
.sort((x, y) => users[y] - users[x])
|
||||||
|
|
Loading…
Reference in a new issue