Code Monkey home page Code Monkey logo

geoguessr_async's Introduction

This is a Geoguessr API client written in Python. It allows you to interact with the Geoguessr API, such as getting information about users, challenges, maps, and scores.

To install the package, run the following command:

pip install geoguessr-async

Once the package is installed, you can create a client object by passing your NCFA cookie to the constructor:

import asyncio
from geoguessr_async import Geoguessr

client = Geoguessr("your_ncfa_cookie")

To get your NCFA cookie, login to geoguessr, open your dev tools (Ctrl+Shift+I), go to Application/Storage/Cookies and copy the value of _ncfa.

You can then use the client object to get information about users, challenges, maps, and scores. For example, to get information about an user with his ID, you can use the following code:

user = await client.get_user_infos(userId)

The Profile object will contain information such as your username, country, and number of games played.

To get information about a challenge, you can use the following code:

challenge = await client.get_challenge_infos("https://geoguessr.com/challenge/xxxx")

The Challenge object will contain information such as the challenge name, description, and time limit.

To get information about a map, you can use the following code:

map = await client.get_map_infos("https://geoguessr.com/maps/xxxx")

The Map object will contain information such as the map name, size, and location.

To get information about a score, you can use the following code:

score = await client.get_challenge_score("https://geoguessr.com/challenge/xxxx")

The Score object will contain information such as the players' name, score, and time. When getting the score of a challenge, it automatically plays it, pinging (0, 0) each round.

Example: Get results of a challenge as a list of dictionnaries

score = await client.get_challenge_score("https://geoguessr.com/challenge/xxxx")
scores = []
for s in score:
    d_player = {
        "userId": s.userId,
        "userName":s.playerName,
        "total": s.totalScore,
        "roundPoints": s.gamePlayerGuessesRoundScoreInPoints,
        "roundTimes": s.gamePlayerGuessesTime
    }
    scores.append(d_player)
print(scores)

I hope you find this package useful! Please let me know if you have any questions or feedback.

geoguessr_async's People

Contributors

toinoublz avatar xi4774 avatar 4zi77 avatar sabotaz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.