'use strict';
var search = {};
search.data = [];
search.compleate = false;
search.fromGroups = function(id,fields,offset) {
if (offset == undefined) {
offset = 0;
}
VK.call('groups.getMembers', {
group_id: id,
fields: fields,
offset: offset
})
.then(response => {
console.log("spet: " + offset/1000 + "/" + Math.ceil(response.count/1000));
if(response.count <= offset) {
return search.compleate = true;
}
if(response.count > 1000) {
offset = offset + 1000;
search.fromGroups(id,fields,offset)
}
return _.filter(response.items, items => {
return items.online === 1
})
})
.then(list => {
return _.map(list, list => {
return list.id
})
})
.then(list => {
console.log(_.flatten(search.data).length + " + " + list.length);
search.data.push(list);
})
.catch(e => console.log(e))
}
search.fromGroups(22892776,'online',32000);
setInterval(()=>console.log(search.compleate),1000);
https://www.npmjs.com/package/node-vkapiC:\Users\Общий\Desktop\vkpush>node iccup.js
spet: 32/38
0 + 91
false
spet: 33/38
91 + 71
false
spet: 34/38
162 + 94
false
false
spet: 35/38
256 + 79
spet: 36/38
335 + 88
false
spet: 37/38
423 + 46
false
spet: 38/38
469 + 0
true
true
true
true
true
true
^C