Package: geoguessr
Geoguesser Challenge Result API3rd party API for accessing Geoguessr challenge scores. Uses the API found within Geoguessr to extract scores and store them in pandas DataFrames for ease of useInstallationpython3 -m pip install geoguessrIf you'd like to clone it and run it that way, you can that by running the following command after cloning this repository:python setup.py installExamplefromgeoguessrimportGeoguesserfromgeoguessr.utilimportclean# initialize our instance of the classgeo=Geoguessr()# make the html request to APIchallenge_id="abc123"raw_data=geo.get_challenge_scores(chal)scores=clean(raw_data)Sample outputplayerNametotalScoreR1R2R3R4R5John1712045662940478235891243Jane11740862632280838962318Sue101481396327834221121940Bob995451271849974431745Mary87969523318637471745Requirements / InputsIn order to use this API you will need to have participated in the challenge and have your ncfa cookie value stored as the environment variable:GEOGUESSR_COOKIEBy default this library usespython-dotenvand its corresponding.envfile to store environment variables.This value can be found in the dev tools section of your browser. Look for the _ncfa value and copy it. You will store your variable like the following, replacing with your custom cookie value:GEOGUESSR_COOKIE=_ncfa={MY COOKIE VALUE}This is slightly confusing with the double equal sign, but that is how it should be formated so the request can properly go through. To reduce errors this value should be URL encoded (but don't worry that is the default on Chrome dev tools if you copied it over from there).Class Methods.get_challenge_scores(self,challenge_id:str=None)->list:Returns the raw response for the given challenge_id. Challenge_id can be found in the URl of the challenge. This is the code that is found after either/results/or/challenge/in the URL. Because this returns a raw response, there are utility functions to help clean and parse the data into other formsUtility Functions (from util import *).clean(raw_data:list,column_list:list=["totalScore"],include_round_scores:bool=True)->pd.DataFrameThe main parsing function to clean challenge scores and put them into a DataFrame.raw_data: is your response from.get_challenge_scores()column_list: is which columns you'd like to include, by default this is only the totalScore, but a list of all columns you can chose from is included below.include_round_scores: will determine if you would like to see each round score included in your output, by default this is True and will show each rounds' score.Potential Columns#ColumnDtype0gameTokenobject1userIdobject2totalScoreint643isLeaderbool4pinUrlobject5game.tokenobject6game.typeobject7game.modeobject8game.stateobject9game.roundCountint6410game.timeLimitint6411game.forbidMovingbool12game.forbidZoomingbool13game.forbidRotatingbool14game.streakTypeobject15game.mapobject16game.mapNameobject17game.panoramaProviderint6418game.bounds.min.latfloat6419game.bounds.min.lngfloat6420game.bounds.max.latfloat6421game.bounds.max.lngfloat6422game.roundint6423game.roundsobject24game.player.totalScore.amountobject25game.player.totalScore.unitobject26game.player.totalScore.percentagefloat6427game.player.totalDistance.meters.amountobject28game.player.totalDistance.meters.unitobject29game.player.totalDistance.miles.amountobject30game.player.totalDistance.miles.unitobject31game.player.totalDistanceInMetersfloat6432game.player.totalTimeint6433game.player.totalStreakint6434game.player.guessesobject35game.player.isLeaderbool36game.player.currentPositionint6437game.player.pin.urlobject38game.player.pin.anchorobject39game.player.pin.isDefaultbool40game.player.newBadgesobject41game.player.newObjectivesobject42game.player.explorerobject43game.player.idobject44game.player.nickobject45game.player.isVerifiedbool46game.progressChange.xpProgressionsobject47game.progressChange.awardedXp.totalAwardedXpint6448game.progressChange.awardedXp.xpAwardsobject49game.progressChange.prevRankobject50game.progressChange.newRankobject51game.progressChange.medalint6452game.progressChange.seasonProgressobject53game.progressChange.competitiveProgressobject