D
D
Dmitry Bayov2017-05-14 10:30:40
Java
Dmitry Bayov, 2017-05-14 10:30:40

VK Api request groups.getMembers. How does it work?

Good day.
I am writing a parser for VKontakte, one of the blocks pulls out the id of the group members, here is the code.

ArrayList<String> getLinksList() throws IOException, ClientException, ApiException {
        ArrayList<String> linksList = new ArrayList<>();

        List<Integer> linkList = vkApiClient.groups().getMembers(actor).groupId(getGroupLink()).offset(getOffset()).execute().getItems();


        for (Integer friend : linkList) {
            linksList.add("https://vk.com/id"+friend+"\r\n");
        }
        return linksList;
    }

    Integer getMembersCount() throws ClientException, ApiException {
        actor = AuthorizationOnVkCom.getActor();
        return vkApiClient.groups().getMembers(actor).groupId(getGroupLink()).execute().getCount();
    }

First, the controller requests the number of group members, based on this number, the progress bar goes, and the next portion of members is requested (maximum number of objects in the response == 1000).
Initially tested on a group of 3k users, everything works well. Then it became interesting how to parse closed groups. Well, since I only need the id of the participants, and this information is publicly available, I just put a link to one closed group into my parser. He immediately grabbed and went to parse.
Actually what is the problem. When parsing a group with more than 8,000 members, the parser gets up just at these 8 thousand. Tried to add a delay, did not help.
Any ideas?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bayov, 2017-05-14
@SonnySP

I confess. I set the delay to 100ms, nothing worked.
Experimentally, I found out the minimum possible delay of 221ms (more is possible, but why?), It no longer perceives less delay.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question