moshiur.bd's blog

By moshiur.bd, history, 8 years ago, In English

How to extract Handles from rank-list of a specific organization/country?

Is there any way to do it with existing codeforces API? If yes, please tell me how.

  • Vote: I like it
  • +7
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I expected some comments...

»
8 years ago, # |
Rev. 2   Vote: I like it +2 Vote: I do not like it

There is no direct method in the API, however, you could load information for users through users.info method and then filter by organization or country field.

You may found useful my library for Codeforces API, written in Python. I've made a script in order to help you with your issue

  • »
    »
    8 years ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    Thank you very much for your work.....

    I don't know python though.... But the Idea may help....

    There is a 5 requests/sec limit with codeforces API. tell me, how many API request actually needed to get an organization's handles?

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You should made at least 1 + ceil(N / 10 000) calls to the API, where N is the number of distinct user handles in all RanklistRow objects. In each call of users.info you could pass up to 10 000 handles. This may not fit into the length of the url, though, so you may need to use more calls to users.info.

      • »
        »
        »
        »
        8 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        Then It's not gonna work!!! I need to make a request several times in a day. Actually I need to reorder the ranklist for a specific organization . It would be great if I could extract the handles in 1-10 API requests.

        But, Now I find, input those handles manually is a better option!! :(

        • »
          »
          »
          »
          »
          8 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          And what is the problem?

          1. Load all RanklistRow using contest.standings
          2. Extract all distinct user handles from row.party.members
          3. Load information for each user using users.info
          4. Reorder RanklistRow using user.organization field.