flowerpicker 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +19 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -114,7 +114,7 @@ class FlowerPicker {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
async getProfileId(game, id) {
|
|
117
|
-
const res = await this._fetchWithCookie(`${this._baseURL}/game/${game}/profile/${id}`);
|
|
117
|
+
const res = await this._fetchWithCookie(`${this._baseURL}/game/${game}${this._doesGameHaveProfileInUrl(game) ? '/profile' : ''}/${id}`);
|
|
118
118
|
const html = await res.text();
|
|
119
119
|
const $ = cheerio.load(html);
|
|
120
120
|
|
|
@@ -124,6 +124,24 @@ class FlowerPicker {
|
|
|
124
124
|
return href.split("/")[4] ?? null;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
_doesGameHaveProfileInUrl(game) {
|
|
128
|
+
switch (game) {
|
|
129
|
+
case 'iidx':
|
|
130
|
+
case 'jubeat':
|
|
131
|
+
case 'rb':
|
|
132
|
+
case 'gitadora':
|
|
133
|
+
case 'sdvx':
|
|
134
|
+
case 'museca':
|
|
135
|
+
return true;
|
|
136
|
+
case 'ddr':
|
|
137
|
+
case 'nostalgia':
|
|
138
|
+
case 'pnm':
|
|
139
|
+
return false;
|
|
140
|
+
default:
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
127
145
|
async _fetchWithCookie(url) {
|
|
128
146
|
return fetch(url, {
|
|
129
147
|
headers: {
|