aboutsummaryrefslogtreecommitdiff
path: root/e621/parse.js
blob: b848708dde0b1ba95b56aa3b47d20e4e39105f36 (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
25
26
27
28
29
30
const fs = require('fs');

let tags = require('./tags.json');
let aliases = require('./tag_aliases.json');
let final = {};

for (let tag of tags) {
    final[tag.name] = {
        id: tag.id,
        allowedNames: [tag.name],
        usage: tag.postCount,
        category: tag.category,
        derpibooruMatch: null
    }
}

for (let alias of aliases) {
    if (alias.status === "deleted" || alias.status === "pending") continue;

    try {
        let aliasedTag = final[alias.consequentName];
        aliasedTag.allowedNames.push(alias.antecedentName);
    } catch (e) {
        console.error(e);
        console.log(alias);
        return;
    }
}

fs.writeFileSync("parsed_tags.json", JSON.stringify(final, null, 2));