Update categories for EDB ID script

This commit is contained in:
ewin 2025-08-20 00:03:24 -06:00
parent 37129d3833
commit 644a7e1d92
Signed by: erin
SSH key fingerprint: SHA256:swjoHhREbZPbWe+gyJNi24d4NAxJSyUIm3fpZj4z3wc
2 changed files with 18 additions and 11 deletions

View file

@ -33,18 +33,21 @@ function insertInfoboxEDBID (pageContent, edbID) {
const mw = await getMediawikiClient();
// Get pages in the "Missing EDB ID" category from the main article namespace
const [itemPagesWithoutEDBIDs, questPagesWithoutEDBIDs] = await Promise.all([
mw.listCategoryPages('Category:Missing EDB ID', [0], +process.env.LIMIT || 500),
mw.listCategoryPages('Category:Missing quest EDB ID', [0], +process.env.LIMIT || 500),
]);
console.log('Processing', itemPagesWithoutEDBIDs.length, 'item pages from [[Category:Missing EDB ID]]\n');
console.log('Processing', questPagesWithoutEDBIDs.length, 'item pages from [[Category:Missing quest EDB ID]]\n');
const categoryTypes = {
'Category:Items with no EDB ID specified': 'item',
'Category:Minions with no EDB ID specified': 'item',
'Category:Triple Triad cards with no EDB ID specified': 'item',
'Category:Quests with no EDB ID specified': 'quest',
};
for (const {title, type} of [
...itemPagesWithoutEDBIDs.map(({title}) => ({title, type: 'item'})),
...questPagesWithoutEDBIDs.map(({title}) => ({title, type: 'quest'})),
]) {
const pages = (await Promise.all(Object.entries(categoryTypes).map(async ([category, type]) => {
const pages = await mw.listCategoryPages(category, [0], +process.env.LIMIT || 500);
return pages.map(({title}) => ({title, type}));
}))).flat();
console.log('Processing', pages.length, 'items\n');
for (const {title, type} of pages) {
// this runs serially with an artificial delay between requests to decrease
// the chance of sqenix sending ninjas to my house
await new Promise(resolve => setTimeout(resolve, 1000));

View file

@ -1,5 +1,8 @@
#!/usr/bin/env -S node --env-file-if-exists=.env
console.log(process.env);
process.exit(1);
import {findItemGTID} from '../lib/api/xivapi.js';
import {getMediawikiClient} from '../lib/config.js';
import {diff} from '../lib/util/diff.js';
@ -33,6 +36,7 @@ function insertInfoboxGTBID (pageContent, gtID) {
const mw = await getMediawikiClient();
// TODO: update this to work with the new maintenance category hierarchy
// Get pages in the "Missing internal ID" category from the main article namespace
const itemPagesWithoutGTIDs = await mw.listCategoryPages('Category:Missing internal ID', [0], +process.env.LIMIT || 500);
console.log('Processing', itemPagesWithoutGTIDs.length, 'item pages from [[Category:Missing internal ID]]\n');