Can we search users by nationality (flag)?

I would like to search for users having a certain nationality. Maybe by other stats too. Currently, a single text box appears where I can search by username, but nothing else. Currently, is there any way to meet this search criteria?

2 Likes

There isn’t currently, but that’s something we’ve thought about adding too, just hasn’t made it in yet

2 Likes

Has this ever been implemented? I am not being able to find it, and it would save my current situation (as well as many other reasonable options would, none of which I am able to find now).

For context I am right now hunting for a “random” user that started a chat with me a few minutes ago while I was playing, I minimized chat to check later so that it was not distracting during game, but then accidently closed it and I cannot find it again. So if there is anywhere you can check all your “recent chats” in OGS, that would solve this case too.

I do not remember the full username, only nationality, a very common prefix (so since only “a few” users are shown, I cannot find them there in the search user box), and a word at the suffix of username (but I am finding no way to search by “substring of username that is not prefix”).

Alternatively, is there a “spectator history” for a game? They were briefly a spectator for my ongoing game, but left before I could click the username.

You can also search by exact email, if it is known. (Won’t auto complete with partials like usernames do)

Would be lovely. Sadly doesn’t exist.

This could be cool too… don’t have it either though.

Can you?

1 Like

I have since writing the message found we can search by flag using the api, but there is no “front end” way to do it.

For example going to Player List – Django REST framework gives you all users with Argentine flag and going to Player List – Django REST framework gives you all users with Starfleet flag.

Furthermore, with the api you can search by “exact anything” mostly, using that_thing=value instead of country=value

Parameter &page_size=100 allows 10 times faster iteration (but 100 seems to be the maximum, which I find a bit low. It will encourage crawling programs to make more requests, which might be heavier on the server in total than fewer larger requests).

Using the fact that at least for usernames it seems that you can query for > by using username__gt=lastUsernameInPage, you can page by page iterate all usernames having a certain prefix (but still there is no support for searching users by “middle name” which is a more complex query requiring more complicated index data structures, we have to query all names and then do substring search on our computer).

I could find nothing in the api regarding messages between users, so I assume that is totally separate (and that one does make sense to be away from public api for privacy reasons).

I’ll probably share a short script soon just in case it is useful to somebody else, once I’ve checked it works :slight_smile:

2 Likes

The script worked! I found my user!! And the previous chat messages were still there! :smiley:

I vaguely remembered “username starts with pa” (really, that was all, I was actually mislead because I thought it started with “papa” at first but it actually went “par” so “pa” was all I got correct XD), and critically a four letter substring (which was not even totally correct, as one of the vowels I remembered incorrectly XD).

Still, from OGS usability point of view, the fact that I CANNOT go back to see recent chat messages that I received / sent without KNOWING the username of who the other user was, is totally bonkers.

Here I share my script if it is useful for others, you can simply run it as python3 ogsapi.py prefix. So it takes the prefix as single parameter, and for example I used python3 ogsapi.py “pa”.

Also, adding parameters to the querystring in the code you can refine the search, for example adding &country=_Starfleet to the querystring will only iterate users with that flag.

The script will print all usernames with that prefix. So you can locally redirect output to a file for later processing, like say command “python3 pa ogsapi.py | grep -i sub” will only show usernames starting with pa and containing sub as substring (in any position, not just at the beginning). In my case, running python3 ogsapi.py “pa” so that it gets all 15775 usernames starting with pa took 2 minutes.

Script is probably very fragile and hacky (the zzzzzzz thing is very hacky in particular). Use at your own risk.

import requests
import sys

def main():
    required_prefix=sys.argv[1]
    le_string = required_prefix + "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
    last_player=required_prefix
    equal_querystring = "e"
    url = "https://online-go.com/api/v1/players?page_size=100&username__gt{}={}&username__lte={}"
    while True:
        results = requests.get(url.format(equal_querystring, last_player, le_string)).json()["results"]
        if not results:
            return
        for player in results:
            username = player["username"]
            print(username, flush=True)
            last_player = username
        equal_querystring = ""

if __name__ == "__main__":
    main()

4 Likes

Aaah my bad… seems it’s only a mod power.

2 Likes

I don’t think we may know through OGS informations the nationality of a player (even with the email if it were accessible)

1 Like

:stuck_out_tongue: sed ‘s/nationality/flag/g’

Flag is not nationality, it’s what each user wants to show in his profile.
Not all flags are national (LGBT, starfleet…) and you can chose a national flag for other reasons as being your nationality. Like aesthetic, politics, dreams, whatever.

4 Likes

In fact, it’s important to note that users suprisingly frequently chose a flag that is not their nationality.

I don’t mean that they chose special flags, I mean, they chose a flag of a country that is not their nationality.

image

5 Likes

How do you know if people do that “frequently”?

1 Like

Yeah, I imagine that in the last few years there are some Ukrainian flag based on sympathy than on nationality. And besides that what to do with the Klingons, Pirates etc.?

Let’s wait for someone who wants to search on the basis of gender.
I foresee complicated and heated discussions on lgbtq+. Well, maybe this is not a good idea. Yeah, strike that maybe.

We all have a place in the profile to write whatever we want, including nationality if you think it’s useful.

Just to be clear, I always intended to ask about flag. Of course “out of OGS, IRL nationality” is impossible to know and it was not the intended question. The topic is stuck with this title, but I think the intention is very clear.

2 Likes

Is it too late to edit the title? (Could be)

Nope. I just used my powers to slightly edit it, hopefully the OP doesn’t mind.

3 Likes

It happens often enough that as a moderator I’m looking into the details that we know about a user on the system and find myself doing a double-take at the difference between their chosen flag (*) and the details that OGS actually has about them.

It’s possible that the frequency I experience is higher than the actual frequency in our overall population, because obviously the users that I’m looking at are “self selecting” in “particular ways”.

But FWIW that was the basis of my observation.


  • (and other details that they make public, such as sharing a name that sounds like the nationality of their flag)
3 Likes