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"));
})()

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

3
package.json Normal file
View file

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