improve JSON data, restructure JSON, and add util scripts

This commit is contained in:
biglyderv 2025-05-10 23:47:03 -04:00
parent 483a51f854
commit c427ddec81
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
4 changed files with 320 additions and 193 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/node_modules
/package-lock.json

50
data_fill.js Normal file
View file

@ -0,0 +1,50 @@
import { readFile, writeFile } from "fs/promises";
function sorter(a, b) {
let ac = isNaN(a.count * 1) ? -1 : a.count;
let bc = isNaN(b.count * 1) ? -1 : b.count;
if (ac != bc) return bc - ac;
let h = a.type.localeCompare(b.type);
if (h != 0) return h;
return a.name.localeCompare(b.name);
}
(async function () {
let jsoned = JSON.parse(await readFile('list.json', 'utf-8'));
jsoned.sort(sorter);
for (let j of jsoned) {
if (!j.link && j.type.startsWith('scratch')) {
let data = await fetch("https://api.scratch.mit.edu/search/projects?limit=16&offset=0&language=en&mode=popular&q=" + encodeURIComponent(j.name));
let jason = await data.text();
try {
jason = JSON.parse(jason);
} catch (err) {
jason = false;
}
if (jason && jason[0]) {
j.link = `https://scratch.mit.edu/projects/${jason[0].id}`
}
}
if (!j.creator && j.type.startsWith('scratch') && j.link) {
if (j.link.endsWith('/')) {
j.link = j.link.slice(0,-1);
}
let splitted = j.link.split('/');
let data = await fetch("https://api.scratch.mit.edu/projects/" + splitted.pop());
let jason = await data.text();
try {
jason = JSON.parse(jason);
} catch (err) {
jason = false;
}
console.log(jason)
if (jason && jason.author) {
j.creator = jason.author.username
}
}
}
await writeFile('list.json', JSON.stringify(jsoned, null, "\t"));
})()

248
list.json
View file

@ -1,193 +1,265 @@
{ [
"gridremix": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 8164, "count": 8164,
"link": "https://scratch.mit.edu/projects/1108657322" "link": "https://scratch.mit.edu/projects/1108657322",
"name": "gridremix",
"creator": "RCUTB"
}, },
"gridsequel": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 2432, "count": 2432,
"link": "https://scratch.mit.edu/projects/1171330726/" "link": "https://scratch.mit.edu/projects/1171330726",
"name": "gridsequel",
"creator": "kamoz99"
}, },
"Elimination War": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 2236, "count": 2236,
"link": "https://scratch.mit.edu/projects/915524770/" "link": "https://scratch.mit.edu/projects/915524770",
"name": "Elimination War",
"creator": "UnOfficalYousef"
}, },
"Tilepgrade!": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 1643, "count": 1643,
"link": "https://scratch.mit.edu/projects/1134777535" "link": "https://scratch.mit.edu/projects/1134777535",
"name": "Tilepgrade!",
"creator": "hooney1006"
}, },
"the dzje gridclose": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 1567, "count": 1567,
"link": "https://scratch.mit.edu/projects/1123295780" "link": "https://scratch.mit.edu/projects/1123295780",
"name": "the dzje gridclose"
}, },
"Gridchaos": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 1323, "count": 1323,
"link": "https://scratch.mit.edu/projects/1138980333/" "link": "https://scratch.mit.edu/projects/1138980333",
"name": "Gridchaos",
"creator": "mark92330"
}, },
"Tiles III": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 734, "count": 734,
"link": "https://scratch.mit.edu/projects/704339952" "link": "https://scratch.mit.edu/projects/704339952",
"name": "Tiles III",
"creator": "Redshell3"
}, },
"World grid": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 660, "count": 660,
"link": "https://scratch.mit.edu/projects/745582603" "link": "https://scratch.mit.edu/projects/745582603",
"name": "World grid"
}, },
"Rectangle grid": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 642, "count": 642,
"link": "https://scratch.mit.edu/projects/921551663/" "link": "https://scratch.mit.edu/projects/921551663",
"name": "Rectangle grid",
"creator": "angelosonic3"
}, },
"Tiles V": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 626, "count": 626,
"link": "https://scratch.mit.edu/projects/944491062/" "link": "https://scratch.mit.edu/projects/944491062",
"name": "Tiles V",
"creator": "QuickCoderLongJumper"
}, },
"gridnations": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 529, "count": 529,
"link": "https://scratch.mit.edu/projects/1115419396/" "link": "https://scratch.mit.edu/projects/1115419396",
"name": "gridnations"
}, },
"2048TB 8x8": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 459, "count": 459,
"link": "https://scratch.mit.edu/projects/668102094/" "link": "https://scratch.mit.edu/projects/668102094",
"name": "2048TB 8x8",
"creator": "HaydenAgain"
}, },
"Tiles": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 458, "count": 458,
"link": "https://scratch.mit.edu/projects/456343869" "link": "https://scratch.mit.edu/projects/456343869",
"name": "Tiles",
"creator": "vmax2019"
}, },
"Tiles IV": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 412, "count": 412,
"link": "https://scratch.mit.edu/projects/632703259" "link": "https://scratch.mit.edu/projects/632703259",
"name": "Tiles IV",
"creator": "player342521"
}, },
"Elimination War III-ba": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 394, "count": 394,
"link": "https://scratch.mit.edu/projects/428529854/" "link": "https://scratch.mit.edu/projects/428529854",
"name": "Elimination War III-ba",
"creator": "brodiejohnevil"
}, },
"GridWars": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 368, "count": 368,
"link": "https://scratch.mit.edu/projects/1125080069" "link": "https://scratch.mit.edu/projects/1125080069",
"name": "GridWars",
"creator": "kamoz99"
}, },
"Circle grid": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 339, "count": 339,
"link": "https://scratch.mit.edu/projects/888667879/" "link": "https://scratch.mit.edu/projects/888667879",
"name": "Circle grid",
"creator": "Winicjusz2"
}, },
"London Grid": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 218, "count": 218,
"link": "https://scratch.mit.edu/projects/1139638835" "link": "https://scratch.mit.edu/projects/1139638835",
"name": "London Grid",
"creator": "Rmgray1028"
}, },
"triangle grid": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 167, "count": 167,
"link": "https://scratch.mit.edu/projects/1117323412/" "link": "https://scratch.mit.edu/projects/1117323412",
"name": "triangle grid"
}, },
"TILEsequel": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 144, "count": 144,
"link": "https://scratch.mit.edu/projects/1158352413" "link": "https://scratch.mit.edu/projects/1144455237",
"name": "MGSTTBIB",
"creator": "mark92330"
}, },
"MGSTTBIB": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 144, "count": 144,
"link": "https://scratch.mit.edu/projects/1144455237" "link": "https://scratch.mit.edu/projects/1158352413",
"name": "TILEsequel",
"creator": "mark92330"
}, },
"Province Royale RP": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 119, "count": 119,
"link": "https://scratch.mit.edu/projects/1165553852" "link": "https://scratch.mit.edu/projects/1165553852",
"name": "Province Royale RP",
"creator": "ckman0705"
}, },
"gridsequel2": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 114, "count": 114,
"link": "https://scratch.mit.edu/projects/1136895805" "link": "https://scratch.mit.edu/projects/1136895805",
"name": "gridsequel2",
"creator": "SquashBuckets"
}, },
"UK Map": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 97, "count": 97,
"link": "https://scratch.mit.edu/projects/1154428165" "link": "https://scratch.mit.edu/projects/1154428165",
"name": "UK Map",
"creator": "Rmgray1028"
}, },
"sidoarjoland": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 72, "count": 72,
"link": "https://scratch.mit.edu/projects/1146021996" "link": "https://scratch.mit.edu/projects/1146021996",
"name": "sidoarjoland",
"creator": "111thew"
}, },
"GSBTNRERAI": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 59, "count": 59,
"link": "https://scratch.mit.edu/projects/1163966387" "link": "https://scratch.mit.edu/projects/1163966387",
"name": "GSBTNRERAI",
"creator": "lincogames"
}, },
"the city gridclose": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 55, "count": 55,
"link": "https://scratch.mit.edu/projects/1137976112/" "link": "https://scratch.mit.edu/projects/1137976112",
"name": "the city gridclose",
"creator": "Hubert_stach78"
}, },
"gridsequel 6x6": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 48, "count": 48,
"link": "https://scratch.mit.edu/projects/1130728792" "link": "https://scratch.mit.edu/projects/1130728792",
"name": "gridsequel 6x6",
"creator": "RCUTB"
}, },
"GSBIH": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 47 "count": 47,
"name": "GSBIH"
}, },
"RHPMGG": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 38 "count": 38,
"name": "RHPMGG"
}, },
"Number-grid": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 29, "count": 29,
"link": "https://scratch.mit.edu/projects/1151883415" "link": "https://scratch.mit.edu/projects/1151883415",
"name": "Number-grid",
"creator": "lincogames"
}, },
"gridremix europe": { {
"type": "scratch/remix", "type": "scratch/remix",
"count": 26, "count": 26,
"link": "https://scratch.mit.edu/projects/1116212068/" "link": "https://scratch.mit.edu/projects/1116212068",
"name": "gridremix europe",
"creator": "ToTheStars693"
}, },
"Tileland": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 12, "count": 12,
"link": "https://scratch.mit.edu/projects/1140335465" "link": "https://scratch.mit.edu/projects/1140335465",
"name": "Tileland",
"creator": "kiaanmsaha15"
}, },
"Gridded": { {
"type": "scratch/comment", "type": "scratch/comment",
"count": 6, "count": 6,
"link": "https://scratch.mit.edu/projects/1157666430" "link": "https://scratch.mit.edu/projects/1157666430",
"name": "Gridded",
"creator": "604sx"
}, },
"gridwars online": { {
"type": "scratch/cloud", "type": "scratch/cloud",
"link": "https://scratch.mit.edu/projects/1151150233" "link": "https://scratch.mit.edu/projects/1151150233",
"name": "gridwars online",
"creator": "LD123Rises"
}, },
"gridwar I": { {
"type": "scratch/comment",
"link": "https://scratch.mit.edu/projects/1165885779",
"name": "gridsequel but is HARDER",
"creator": "lincogames"
},
{
"type": "scratch/comment",
"link": "https://scratch.mit.edu/projects/1149453901",
"name": "gridsequel but tiles",
"creator": "RCUTB"
},
{
"type": "scratch/comment",
"link": "https://scratch.mit.edu/projects/1162274452",
"name": "Reborn's Poorly Made Grid Game",
"creator": "RebornHuman"
},
{
"type": "web/cloud", "type": "web/cloud",
"link": "https://gw.dervland.net/" "name": "gridwar I"
}, },
"gridwar II": { {
"type": "web/cloud" "type": "web/cloud",
}, "link": "https://gw.dervland.net/",
"gridsequel but tiles": { "name": "gridwar II"
"type": "scratch/comment",
"link": "https://scratch.mit.edu/projects/1149453901"
},
"gridsequel but is HARDER": {
"type": "scratch/comment",
"link": "https://scratch.mit.edu/projects/1165885779"
},
"Reborn's Poorly Made Grid Game": {
"type": "scratch/comment",
"link": "https://scratch.mit.edu/projects/1162274452"
} }
} ]

3
package.json Normal file
View file

@ -0,0 +1,3 @@
{
"type": "module"
}