diff options
-rw-r--r-- | build/mojang.js | 5 | ||||
-rw-r--r-- | src/mojang.ts | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/build/mojang.js b/build/mojang.js index ef4f7fd..6180b15 100644 --- a/build/mojang.js +++ b/build/mojang.js @@ -55,11 +55,12 @@ async function profileFromUsername(username) { return await profileFromUsername(username); } let data; + const rawData = await fetchResponse.text(); try { - data = await fetchResponse.json(); + data = JSON.parse(rawData); } catch { } - console.log('mojang returned', data); + console.log('mojang returned', rawData); if (!(data === null || data === void 0 ? void 0 : data.id)) { console.log('mojang api failed, trying ashcon as backup'); return await profileFromUsernameAlternative(username); diff --git a/src/mojang.ts b/src/mojang.ts index 17918b1..473f9c3 100644 --- a/src/mojang.ts +++ b/src/mojang.ts @@ -68,11 +68,12 @@ export async function profileFromUsername(username: string): Promise<MojangApiRe } let data + const rawData = await fetchResponse.text() try { - data = await fetchResponse.json() + data = JSON.parse(rawData) } catch {} - console.log('mojang returned', data) + console.log('mojang returned', rawData) if (!data?.id) { console.log('mojang api failed, trying ashcon as backup') |