Last active
July 3, 2025 08:32
-
-
Save Aracturat/0245732d4ff99c1391c8e75bac9115ff to your computer and use it in GitHub Desktop.
Get Challenges Score
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const challenges = [ | |
'https://www.geoguessr.com/challenge/Tce0cO2flQC7DiVI', | |
'https://www.geoguessr.com/results/0e47oFKUH8QeZe7v', | |
'https://www.geoguessr.com/results/gJ4YKPdO3C7eRj73', | |
]; | |
const getGameResults = (gameId) => { | |
return fetch( | |
`https://www.geoguessr.com/api/v3/results/highscores/${gameId}?friends=false&limit=500&minRounds=5`, | |
{ | |
method: "GET", | |
credentials: "include", | |
} | |
).then((e) => e.json()).catch(() => ({ items: [] })); | |
}; | |
(async () => { | |
const result = {} | |
for (const challenge of challenges) { | |
const id = challenge.split('/').at(-1); | |
const results = await getGameResults(id) ?? []; | |
let score = 5; | |
for (const item of results.items ?? []) { | |
const player = item.game.player.nick; | |
result[player] ??= 0; | |
result[player] += score; | |
score = score > 0 ? score - 1 : 0; | |
} | |
} | |
const sortedResult = Object.entries(result).sort((a, b) => b[1] - a[1]); | |
console.log(sortedResult.map(([user, score]) => `${user}: ${score}`).join('\n')) | |
console.log('For google docs:'); | |
console.log(sortedResult.map(([user, score]) => `${user}\t${score}`).join('\n')) | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment