#!/usr/bin/env -S node --env-file-if-exists=.env import {getMediawikiClient} from '../lib/config.js'; const mw = await getMediawikiClient(); const start = parseInt(process.env.START ?? '1', 10) for (let bin = start; bin <= 50; bin += 1) { // files are at e.g. https://gacha.infi.ovh/data/desynthesis/026000.json const filename = `${String(bin).padStart(3, '0')}000.json`; const url = `https://gacha.infi.ovh/data/desynthesis/${filename}`; const targetPage = `Module:Desynthesis/${filename}`; console.log('Bin', bin, url, '->', targetPage); // download const data = await fetch(`https://gacha.infi.ovh/data/desynthesis/${filename}`).then(response => response.json()); // upload try { await mw.editPage(`Module:Desynthesis/${filename}`, JSON.stringify(data), 'update desynth data'); console.log('Written.'); } catch (error) { // terrible throw error; } // self-ratelimiting - 6 requests per minute should be enough for anyone :clueless: await new Promise(resolve => setTimeout(resolve, 10000)); }