blob: d9401f8115b7410089b024a7720cd12d5258404f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const axios = require("axios");
const fs = require("fs");
if (fs.existsSync("./data")) fs.rmSync("./data", { recursive: true });
fs.mkdirSync("./data");
(async () => {
async function getCategory(category) {
console.log("Category:" + category);
let cat = (await axios.get("https://mlp.fandom.com/api.php?action=query&generator=categorymembers&gcmtitle=Category:" + encodeURI(category) + "&prop=categories&cllimit=max&gcmlimit=max&format=json")).data;
return Object.keys(cat.query.pages).map(k => cat.query.pages[k].title).filter(k => !k.startsWith("List") && !k.includes("EG") && !k.toLowerCase().includes("ponies") && !k.includes(" and ") && !k.includes("(") && !k.includes("family"));
}
let list = [...new Set([
...(await getCategory("Pegasus ponies")),
...(await getCategory("Alicorn ponies")),
...(await getCategory("Earth ponies")),
...(await getCategory("Unicorn ponies")),
...(await getCategory("Main characters")),
...(await getCategory("Dragons")),
])];
fs.writeFileSync("./data/list.json", JSON.stringify(list, null, 4))
})()
|