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?
There isnât currently, but thatâs something weâve thought about adding too, just hasnât made it in yet
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?
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
The script worked! I found my user!! And the previous chat messages were still there!
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()
Aaah my bad⌠seems itâs only a mod power.
I donât think we may know through OGS informations the nationality of a player (even with the email if it were accessible)
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.
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.
How do you know if people do that âfrequentlyâ?
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.
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.
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)