B
B
buhalo882015-03-03 00:50:01
API
buhalo88, 2015-03-03 00:50:01

How to get the id of the user accounts of the VKontakte group via api using vkscript and the execute method?

waters proper code

var members = API.groups.getMembers({"group_id": "habr", "v": "5.28","count": "1000", "offset": Args.tek }).items;
var offset = 1000;
while (offset < 25000 && (offset+Args.tek) <  Args.total ){
    members = members + API.groups.getMembers({"group_id": "habr", "v": "5.28",  "count": "1000", "offset":  Args.tek + offset}).items;
    offset = offset + 1000;
}
return members;

the code should return an array of the first group account id's of 25,000 starting from Args.tek. It does so if arg.tek =< Args.tek / 10000, otherwise it returns 1000 values.
Day 3 I don't know what the problem is.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2015-03-03
@Taraflex

habrahabr.ru/post/248725

F
fang_k11, 2017-02-15
@fang_k11

I hope that it will be useful to someone. I fought myself, then I realized that the arguments in the stored procedure are passed as strings, they must be explicitly converted to integers.

var members = API.groups.getMembers({"group_id": Args.group_id, "v": "5.28","count": "1000", "offset": Args.tek }).items;
var offset = 1000;
while (offset < 25000 && (offset+parseInt(Args.tek)) <  parseInt(Args.total)){
    members = members + API.groups.getMembers({"group_id": Args.group_id, "v": "5.28",  "count": "1000", "offset":  parseInt(Args.tek) + offset}).items;
    offset = offset + 1000;
}
return members;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question