Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { jsonArrayToJsonL } from "https://esm.town/v/fossforlife/jsonl";
import { parseXML } from "https://esm.town/v/stevekrouse/parseXML";
export default async function(req: Request): Promise<Response> {
try {
const xml = await fetch("https://ej-public-files.sfo3.cdn.digitaloceanspaces.com/wiitdb.xml");
const xmlInput = await xml.text();
const jsonOutput = await parseXML(xmlInput);
const jsonl = jsonArrayToJsonL(jsonOutput.datafile.game);
return new Response(jsonl);
} catch (e) {
return Response.json({ message: "Unknown error" }, {
status: 400,
});
}
}
fossforlife-wiitdb_jsonl.web.val.run
June 15, 2024