diff options
author | Minteck <contact@minteck.org> | 2022-02-13 16:16:18 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-02-13 16:16:18 +0100 |
commit | 327119b4d1c2248b8a075cad3cd05ab92560e75d (patch) | |
tree | ce143399e74c120f7311e75490efd0defd9b58d8 /update/pages.js | |
parent | ede8d0750f3f16e3ba5c3c3f716c98d267512b09 (diff) | |
download | ponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.tar.gz ponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.tar.bz2 ponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.zip |
Feature: implements #8, voids #9
Diffstat (limited to 'update/pages.js')
-rw-r--r-- | update/pages.js | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/update/pages.js b/update/pages.js deleted file mode 100644 index 7f3a1c8..0000000 --- a/update/pages.js +++ /dev/null @@ -1,28 +0,0 @@ -const fs = require('fs'); -const axios = require('axios'); - -(async () => { - console.log("Gathering pages list..."); - let pages = []; - for (let page of JSON.parse(fs.readFileSync("./data/list.json").toString())) { - console.log("Searching for '" + page + "'..."); - try { - let data = (await axios.get("https://mlp.fandom.com/api.php?action=query&list=search&srsearch=" + encodeURI(page) + "&srlimit=1&srenablerewrites=true&format=json")).data; - if (data.query.search.length > 0) { - console.log("Results found, adding name to database") - pages.push({ - query: page, - name: data.query.search[0].title, - mwid: data.query.search[0].pageid, - words: data.query.search[0].wordcount, - }) - } else { - console.log("No results found, ignoring name"); - } - } catch (e) { - console.error(e); - } - } - - fs.writeFileSync("./data/pages.json", JSON.stringify(pages, null, 4)) -})()
\ No newline at end of file |