aboutsummaryrefslogtreecommitdiff
path: root/e621/parse.js
diff options
context:
space:
mode:
Diffstat (limited to 'e621/parse.js')
-rwxr-xr-xe621/parse.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/e621/parse.js b/e621/parse.js
new file mode 100755
index 0000000..b848708
--- /dev/null
+++ b/e621/parse.js
@@ -0,0 +1,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));