Skip to content

Instantly share code, notes, and snippets.

@digitalhitler
Created September 28, 2018 10:25
Show Gist options
  • Save digitalhitler/651ed587e6454aa29d15a972bb1454a2 to your computer and use it in GitHub Desktop.
Save digitalhitler/651ed587e6454aa29d15a972bb1454a2 to your computer and use it in GitHub Desktop.
Dump newsfeed (VKScript)
/* @lang VKScript */
var items = [];
var result = API.newsfeed.get(
{"filters": "video,post,photo,wall_photo" }
);
if(!result.items) {
return false;
}
var totalPlanned = parseInt(result.count);
var total = result.items.length;
var offset = parseInt(result.items.length);
var iterations = 1;
var left = totalPlanned - offset;
items = result.items;
if(result.items.length > 0) {
var loadAll = 0; while(loadAll < result.items.length && left > 0 && iterations < 23) { }
if(offset > 0) {
while(offset < 10000 && left > 0 && iterations < 23) {
iterations = iterations + 1;
result = API.video.get({
"count": 200,
"extended": true,
"videos": result.items.id
});
if(result.length > 0) {
offset = offset + result.length;
left = left - result.length;
total = total + result.length;
items = items + result;
}
}
}
}
// return true;
return {
count: total,
countPlanned: totalPlanned,
iterations: iterations,
items: items
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment