Skip to content

Instantly share code, notes, and snippets.

@averman
Last active May 8, 2022 13:47
Show Gist options
  • Save averman/68cdb24722c3af300c8b5dbdc8dd7df9 to your computer and use it in GitHub Desktop.
Save averman/68cdb24722c3af300c8b5dbdc8dd7df9 to your computer and use it in GitHub Desktop.
geoguessr cheat
// can be embedded into cjs or greasemonkey, or just paste directly into the console on dev-tools
// click cheat to get coordinate
// click coordinate to open external google maps pinned on the answer
// click finetune to compare your guess to the actual answer difference
let a = document.createElement('div')
a.setAttribute('style','position: absolute; left:0; top: 0; width: 500px; height: 50px; z-index: 9999')
a.innerHTML = `<p>CHEAT</p><div id="cheat-base"></div><div id="cheat-ans"></div><div class="cheat-ft">Fine Tune:</div><div class="cheat-ft" id="cheat-ft-ans">---</div>`
a.onclick = function(){
if(location.pathname.startsWith('/battle-royale/') || location.pathname.startsWith('/duels/') || location.pathname.startsWith('/game/') || location.pathname.startsWith('/challenge/')){
let rc = `https://game-server.geoguessr.com/api${location.pathname}/reconnect`;
if(location.pathname.startsWith('/game/') || location.pathname.startsWith('/challenge/')){
let gt = location.pathname.startsWith('/game/')? location.pathname.split('/')[2] : __NEXT_DATA__.props.pageProps.game.token;
rc = `https://www.geoguessr.com/api/v3/games/${gt}?client=web`
}
fetch(rc,{credentials: 'include'}).then(x=>x.json()).then(x=>{
let rounds = x.rounds;
let cur = x.currentRoundNumber -1;
if(Number.isNaN(cur)) cur = x.round -1;
let round = rounds[cur];
if(location.pathname.startsWith('/duels/')) round = round.panorama;
let lat = round.lat;
let lng = round.lng;
let cb = document.querySelector('#cheat-base');
cb.innerHTML=`${lng}, ${lat}`;
cb.onclick = ()=>window.open(`https://www.google.com/maps/place/${lat},${lng}/@${lat},${lng},6.7z`,"answer")
function finetune(){
let mp = document.querySelector('.map-pin');
if(mp) {
let fkey = Object.keys(mp).filter(x=>x.startsWith('__reactFiber'))[0];
let fiber = mp[fkey];
let gpLat = fiber.return.return.return.memoizedProps.lat
let gpLng = fiber.return.return.return.memoizedProps.lng
document.querySelector("#cheat-ft-ans").innerHTML = `${lng-gpLng}, ${lat-gpLat}`
}
}
[...document.querySelectorAll('.cheat-ft')].forEach(e=>e.onclick=finetune);
})
}
}
document.body.append(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment