Every member has a two char country code in this endpoint.
https://api.chess.com/pub/player/{username}
They are all ISO country codes with a few extras for exceptions.
This a link to the ISO standards used
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
These are the additonals
XA
: "Canary Islands"XB
: "Basque Country"XC
: "Catalonia"XE
: "England"XG
: "Galicia"XK
: "Kosovo"XP
: "Palestine"XS
: "Scotland"XW
: "Wales"XX
: "International"
When I extract the club members and flag logins I extract the code and compare to the two char list.
I do this in Excel so I keep the two code list in a dedicated tab and do a search for the code.
Not sure how you do that in a browser but should be possible in an app by loading the complete list into an array.
I suppose you could than add a JPEG link into the list and then load the image,
But it sounds a pain.
I've been asked to compile a list of all the members in a club, in order of numbers of each nationality or country. Easy enough using the available endpoint data for club members, member profile & country data.
But then I was asked if I could provide the country flag against each national group of members & that made me stop & think - how can you do that from endpoint data alone?
I can solve this by painstakingly collecting all the country flags image URL's but is there an easier way?