mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-04-24 23:07:11 -05:00
Add festival ranking data
This commit is contained in:
parent
7767f8c49c
commit
c14e4a0502
27
app/data/updaters/FestivalRankingUpdater.mjs
Normal file
27
app/data/updaters/FestivalRankingUpdater.mjs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import DataUpdater from "./DataUpdater.mjs";
|
||||
|
||||
export default class FestivalRankingUpdater extends DataUpdater
|
||||
{
|
||||
name = 'FestivalRankingUpdater';
|
||||
filename = 'festivals.ranking';
|
||||
|
||||
constructor(region = null, festID = null) {
|
||||
super(region);
|
||||
|
||||
this.festID = festID;
|
||||
this.filename += `.${region}.${festID}`;
|
||||
}
|
||||
|
||||
imagePaths = [
|
||||
'$..image.url',
|
||||
'$..originalImage.url',
|
||||
'$..image2d.url',
|
||||
'$..image2dThumbnail.url',
|
||||
'$..image3d.url',
|
||||
'$..image3dThumbnail.url',
|
||||
];
|
||||
|
||||
getData(locale) {
|
||||
return this.splatnet(locale).getFestRankingData(this.festID);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import fs from 'fs/promises';
|
||||
import DataUpdater from "./DataUpdater.mjs";
|
||||
import FestivalRankingUpdater from './FestivalRankingUpdater.mjs';
|
||||
|
||||
function getFestId(id) {
|
||||
return Buffer.from(id, 'base64').toString().match(/^Fest-[A-Z]+:(.+)$/)?.[1] ?? id;
|
||||
|
|
@ -38,6 +39,9 @@ export default class FestivalUpdater extends DataUpdater
|
|||
let detailResult = await this.splatnet(locale).getFestDetailData(node.id);
|
||||
|
||||
Object.assign(node, detailResult.data.fest);
|
||||
|
||||
let rankingUpdater = new FestivalRankingUpdater(this.region, node.id);
|
||||
await rankingUpdater.update();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -136,6 +136,10 @@ export default class SplatNet3Client
|
|||
return this.getGraphQLPersistedQuery(1, '2d661988c055d843b3be290f04fb0db9', { festId });
|
||||
}
|
||||
|
||||
getFestRankingData(festId) {
|
||||
return this.getGraphQLPersistedQuery(1, '58bdd28e3cf71c3bf38bc45836ee1e96', { festId });
|
||||
}
|
||||
|
||||
getCurrentFestData() {
|
||||
return this.getGraphQLPersistedQuery(1, 'c0429fd738d829445e994d3370999764');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user