Error with https://api.chess.com/pub/country/{ID}/players

Sort:
Tricky_Dicky

Agree. Used to get upto 180k GB members: Now 10k like NL. Doesn't go beyond initial 'a' usernames.

US get 20k.

bcurtis

It turns out that no simple solution exists to make this endpoint work. So I would like each of you who use this endpoint to describe in just a couple sentences:

  1. What you use the data for.
  2. How you obtain the data.

With your input, we'll see if a new, simpler solution works.

Tricky_Dicky

Thanks Ben. Understand that it takes time.

1. I typically ran the endpoint once a day to get usernames for team invite.

i.e. get today's logon list for country code GB (and XE). Compare list to DB of existing club members and previously seen usernames. Assess remainder for suitability for club invite.

2. Accessed via VBA in MS office (Excel)

Set xmlhttp = CreateObject("msxml2.xmlhttp.6.0")

with xmlhttp 

          .Open "get", "https://api.chess.com/pub/country/GB/players", False

          .setRequestHeader  "User-Agent",    ..........

          .send

          get_data_string = .responseText

end with

Tricky_Dicky

Suggestion:

Indexed listings limited to 15k (or value TBC) entries.

i.e. GB/players(1), GB/players(2), ....., GB/players(n)

Program solution to upload would be loop through indexes until null list.

 

Nevfy

1. Same as @Tricky_Dicky (normally once per week).

2. Python script using HTTP requests.

Update: Seeing comment from @RainPiper I modified my comment to precise the frequency of use.

RainPiper

1. Same as @Tricky_Dicky . (Except that I access this endpoint considerably less frequently. Normally not more often than once per month.)

2. R script using HTTP requests.

YankeeBastid

I run that API when I need to pull a group of players to test their rapid 30-min ratings over a 30-day period.

I use the results when I call

curl_setopt($curl, CURLOPT_URL,"https://www.chess.com/callback/live/stats/$username/chart?daysAgo=30&type=rapid&ref_id=1932587");

bcurtis

Apologies for the slow cycle time here.

With four responses, 3 are for club invites and 1 is to get a random selection for a proof-of-concept tournament.

Is there any reason that we need to keep grouping these by country? Is that the best way to target the right people?

It seems that all of you use a program to obtain the data. So it sounds like pagination would work, or some other sub-grouping like "A-C", "D-F", ... , "W-Z", "others"?

RainPiper

Thanks for giving this a follow-up.

  • Most of us are working as admins for national teams. So pre-selection by country is extremely useful. Other selection/sorting criteria should be manageable, but then the country information needs to be directly accessible and not require consulting the players' individual profiles.
  • Pagination would be no problem in my setting.
YankeeBastid

Thanks for the update. I will start to make the suggested improvements to my code starting next week. I can live with 10k, if that is cool with you. I use the country read for pulling players into the pool of eligible players. 

Tricky_Dicky

Some method of identification of members by country would be needed I think.

As @RainPiper says, the country listing are very useful for national teams.

If you changed to alphabetic listing, it would be necessary to go through all lists to identify qualifiers by nationality. That sounds like a very heavy and lengthy program run of many 100's of thousand hits.

Pagination would be OK for me, I think.

Nevfy

I fully agree with @RainPiper and @Tricky_Dicky. Since all three of us are working with this endpoint for the sake of national teams, it is absolutely necessary one way or another to filter the obtained list of players by country attribution. 

Pagination is fine for me as well.

bcurtis

Hey, everyone. This hasn't completely dropped off the radar. It has taken an interesting turn. Since all of you who need the per-country listing are using it to target club invites, and bulk/automated invites are a gray area relating to spam BUT club membership is a huge benefit to the players, we have started to re-think this. There is just a lot of overhead in producing these lists which then only partly help you — and we'd prefer to put our energy into helping you a lot, instead.

Tricky_Dicky

Good to know it's still on the list Ben. Being able to access the by-flag logon's is a major benefit to the clubs representing national teams.

Having the access to the list doesn't actually mean we can circumvent the daily 30 invite limit, just gives a list we can work through over time.

Nevfy
Tricky_Dicky wrote:

Having the access to the list doesn't actually mean we can circumvent the daily 30 invite limit, just gives a list we can work through over time.

Exactly! Having the access to the list of players only helps to understand: which players are active on the website and can be interested in joining the club. It has nothing common with massive automated mailing. We (Team Russia) only work within 30 invite daily limit. Moreover, we keep a track of already invited but uninterested/unreacted players to assure that the same player won't receive it more often than once per year.

 

P.S. Looking to the fact that admins of exactly those national teams, who collect huge amount of players on their matches, expressed the need for this information, I can conclude that having the access to the list of active national players is very valuable thing.

RainPiper

Like Tricky_Dicky and Nevfy, I want to emphasise that we use(d) the API info for targeting our 30 invitations per day as well as possible and in no way entered a "grey area" of bulk or automated invites.

Still, we are open to other approaches, of course. I'm curious what this "put our energy into helping you a lot" would amount to.

YankeeBastid

ok, let me be sure I am doing this correctly so I am not out of bounds with the rules. As everyone knows by now, I run a tournament that uses the ratings awarded to a player from a rapid 30-min match here on chess.com. I randomly select players for the tournament who are qualified to compete in it as a demonstration of the concept. No awards are given, just a demonstration. I have worked with bcurtis to change my code to not hammer the servers so badly. 

I display the results externally to chess.com. I take the top 30 winners, regardless of country, and invite them to join the chess.com club 4teamchess International.I do this daily.  If that is out of bounds I need to hear it from the admin. Thanks.

Tricky_Dicky

Doesn't really seem relavent to this forum. i.e. https://api.chess.com/pub/country/{ID}/players

YankeeBastid

A conversation about how we send out invites seemed salient. Sorry to have stepped on your toes, there tricky.

ImperfectAge

Just came across this conversation.

I often used to use the country endpoint to try to identify players who live in particular state, region, city or county to help identify candidates for regional teams. I've helped identify players for several counties in the UK&I inter-club league, for example. So start with the country end point (I've done this for GB and US when it used to work), search the player's location information for specific place names, and then generate a list of candidate invitees.  Optionally may apply other metrics to filter players out, depending on the club.

As others have mentioned, then club admins would work though the list 30 at a time to use the daily invite tool.  

So it's not just national teams, it's regional teams (counties or states).