Skip to content

Instantly share code, notes, and snippets.

@tcortega
Last active December 19, 2022 19:03
Show Gist options
  • Select an option

  • Save tcortega/7378d20dcfa7d15df780032ca2b78b3d to your computer and use it in GitHub Desktop.

Select an option

Save tcortega/7378d20dcfa7d15df780032ca2b78b3d to your computer and use it in GitHub Desktop.
Geoguessr AIO Cheat (Greasemonkey / Tampermonkey)
// ==UserScript==
// @name Geoguessr AIO Cheat
// @namespace https://github.com/tcortega
// @version 1.0.1
// @description Press SHIFT + ALT + G and the location of your current geoguessr game will open in a new tab
// @author tcortega
// @homepage https://github.com/tcortega
// @downloadURL https://gist.github.com/tcortega/7378d20dcfa7d15df780032ca2b78b3d/raw/geoguessr-aio.user.js
// @updateURL https://gist.github.com/tcortega/7378d20dcfa7d15df780032ca2b78b3d/raw/geoguessr-aio.user.js
// @match http*://*/*
// @grant none
// @run-at document-idle
// ==/UserScript==
function getCleanUrl() {
return window.location.href.replace("/reconnect", "").replace("?client=web", "");
}
function getJsonData() {
const rawData = document.querySelector("pre").innerText;
return JSON.parse(rawData);
}
function apiUrlToGameUrl() {
const apiUrl = getCleanUrl();
return apiUrl.replace("game-server.", "").replace("/api", "").replace("/v3", "").replace("");
}
function getGameMode(url) {
return url.split(".com/")[1].split("/")[0].toUpperCase();
}
function getApiUrl(url, gamemode) {
url = url.replace("www.", "");
switch (gamemode) {
case "DUELS":
case "TEAM-DUELS":
case "BATTLE-ROYALE": {
return url.replace("geoguessr.com", "game-server.geoguessr.com/api").replace("team-duels", "duels");
}
case "COMPETITIVE-STREAK": {
return url.replace("geoguessr.com/competitive-streak", "game-server.geoguessr.com/api/competitive-streaks");
}
case "GAME": {
return url.replace("geoguessr.com/game", "geoguessr.com/api/v3/games");
}
}
}
function isApiPage() {
return getCleanUrl().includes("/api/");
}
function makeApiCall(apiUrl) {
window.open(apiUrl, "_blank");
}
function handleChallenge() {
const raw = document.querySelectorAll("#__NEXT_DATA__")[0].text;
const json = JSON.parse(raw);
const rounds = json.props.pageProps.game.rounds;
const { lat, lng } = rounds[rounds.length - 1];
openMaps({ lat, lng }, "_blank");
}
function handleKeyEvent() {
const url = getCleanUrl();
const gameMode = getGameMode(url);
if (gameMode == "CHALLENGE") return handleChallenge();
const apiUrl = getApiUrl(url, gameMode);
makeApiCall(apiUrl);
}
function formatDuelsResponse(jsonData) {
const rounds = jsonData.rounds.map((r) => ({ lat: r.panorama.lat, lng: r.panorama.lng }));
return { round: jsonData.currentRoundNumber, rounds };
}
function formatStreaksResponse(jsonData) {
const rounds = [jsonData.player.currentRound];
return { round: 1, rounds };
}
function formatBattleRoyaleResponse({ currentRoundNumber, rounds }) {
return { round: currentRoundNumber, rounds };
}
function formatGameResponse({ round, rounds }) {
return { round, rounds };
}
function formatResponse(gameMode) {
const jsonData = getJsonData();
if (gameMode == "DUELS"|| gameMode == "TEAM-DUELS") return formatDuelsResponse(jsonData);
if (gameMode == "COMPETITIVE-STREAKS") return formatStreaksResponse(jsonData);
if (gameMode == "BATTLE-ROYALE") return formatBattleRoyaleResponse(jsonData);
if (gameMode == "GAMES") return formatGameResponse(jsonData);
}
function getLocation(gameMode) {
const { round, rounds } = formatResponse(gameMode);
const currentRound = rounds[round - 1];
return { lat: currentRound.lat, lng: currentRound.lng };
}
function openMaps(location, target = "_self") {
const mapUrl = `https://google.com/maps/place/${location.lat},${location.lng}`;
window.open(mapUrl, target);
}
function handleApiPage() {
const gameUrl = apiUrlToGameUrl();
const gameMode = getGameMode(gameUrl);
const location = getLocation(gameMode);
openMaps(location);
}
(function () {
"use strict";
if (!getCleanUrl().includes("geoguessr.com")) return; // Just in case
if (isApiPage()) {
return handleApiPage();
}
// TO-DO: Refactor this so it does not have to figure out which game mode is being used each time the user issues the command (lazy to do rn).
document.onkeydown = (evt) => {
evt = evt || window.event;
if (evt.shiftKey && evt.altKey && evt.keyCode == 71) {
handleKeyEvent();
}
};
})();
@potatobanana123

Copy link
Copy Markdown

@tcortega started

@tcortega

tcortega commented Feb 5, 2022

Copy link
Copy Markdown
Author

@potatobanana123 Pushed an update, it should work fine now.

@potatobanana123

Copy link
Copy Markdown

@tcortega love u

@tcortega

Copy link
Copy Markdown
Author

Hey man, was just wondering if you will update it so it works on the live challenges and bullseye on the play with friends tab. Love the work you do! :)

I don't have that much free time, maybe I will. But if someone wants to go and update it, feel free.

@michele-grifa

Copy link
Copy Markdown

I tried using in Battle Royale Countries, but for some reason with Tampermonkey on Firefox 98 when the API page is loaded, the script is not loaded. It loads only on the game page.

@Ptorioo

Ptorioo commented Apr 8, 2022

Copy link
Copy Markdown

Geoguessr has introduced an anti-cheat.
Instead of showing the latlng in the api it only shows the panoid of the streetview. Currently working on how to convert panoid into lat lng.
Probably need help from you guys lol.

@geohot666

Copy link
Copy Markdown

Doesn't work anymore in Duels. Still works in BR countries and distance. Update plz.

@stoatle

stoatle commented Apr 11, 2022

Copy link
Copy Markdown

You can use a free API call to get the location of a panoid, probably not terribly useful for this script (unless you want to leak your API key or just have people insert their own), but still trivial to cheat

https://maps.googleapis.com/maps/api/streetview/metadata?pano=PANOID&key=YOURAPIKEY

@tcortega

Copy link
Copy Markdown
Author

This weekend I'll take a look into what they made and probb bypass it again

@tcortega

Copy link
Copy Markdown
Author

Took a quick look and all api's structure remains the same, it shouldn't even be a hassle using the actual script. Maybe I'll need to change something up, but, from what it seems, adapting the cheat should be ezpz. If anyone want to do it, just go ahead and do it. Otherwise wait until the weekend.

@Ptorioo

Ptorioo commented Apr 12, 2022

Copy link
Copy Markdown

Guess they removed the anti cheat somehow xDD It's working again in duels. However, I tried implementing it on quizzes and live-challenges but it doesn't seem to work well. It opened the api page on the next tab but failed to load the coordinates lol

@tcortega

Copy link
Copy Markdown
Author

Guess they removed the anti cheat somehow xDD It's working again in duels. However, I tried implementing it on quizzes and live-challenges but it doesn't seem to work well. It opened the api page on the next tab but failed to load the coordinates lol

What exactly are quizzes and live challenges? Doesn't really remember them. And for each different game mode, they have a different "api", to say so. That's why even if you open a new game mode api page, it may fail to load the coordinated because the json response may be structured differently.

@michele-grifa

michele-grifa commented Apr 13, 2022

Copy link
Copy Markdown

I edited the script to work with live-challenge and quiz mode. Basically they use the same api, but the response is formatted slightly different.

https://gist.github.com/michele-grifa/bc70e735905fec7d9d28df0e653dd45d/raw/geoguessr-aio.user.js

@Ptorioo

Ptorioo commented Apr 29, 2022

Copy link
Copy Markdown

I also made a discord server for anyone who are interested in developing new cheat: https://discord.gg/spMdRF8Sku

@averman

averman commented May 8, 2022

Copy link
Copy Markdown

whoa... just found this gem after I implement my own.... same core concept, a bit different implementation....
check mine out!
https://gist.github.com/averman/68cdb24722c3af300c8b5dbdc8dd7df9

@Ptorioo

Ptorioo commented Jun 7, 2022

Copy link
Copy Markdown

This script somehow doesn't work anymore. I made my own working version combined with averman's script: https://github.com/Ptorioo/Geoguessr-Disunity-Script
Competitive Streak is somewhat buggy but I cba to fix it as no one actually plays that anymore lol. Feel free to fix it if anyone is interested.

ghost commented Jun 17, 2022

Copy link
Copy Markdown

@tcortega How to change the code so that a new window appears?

@TheDeezMan

Copy link
Copy Markdown

I also made a discord server for anyone who are interested in developing new cheat: https://discord.gg/spMdRF8Sku

Yo could you get another link for that? I would like to join

@abckljqsf

Copy link
Copy Markdown

Hello, I have a small question. How can we make the new map page replace the old one?

@AKavkaz

AKavkaz commented Jul 30, 2022

Copy link
Copy Markdown

hey @Ptorioo i saw your cheat got removed from github and greasy fork, can you post the same one if you can please?

@Xarond12

Copy link
Copy Markdown

hello, i'm looking for drawing location on map script. I had something like that but by mistake i removed it

@Flair001

Copy link
Copy Markdown

HOW DO YOU DO IT ON MAC???? PLEASE HELP? the shift + alt + g is not on mac (shift)?? where to get?

@michele-grifa

Copy link
Copy Markdown

All the keyboards have a shift. What is your problem?

@volkmanS

Copy link
Copy Markdown

Doesnt work today in duels - in BR its work. WTF ?

@bombcheats

Copy link
Copy Markdown

Confirmed Patched for Duels ( location takes you to Alcatraz every time ). Still working in Battle Royale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment