Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var {VK} = require('vk-io');
- var fs = require('fs');
- const vk = new VK();
- var friends = [], global_arr = [];
- vk.token = ""
- var your_id = 90327755
- async function run(user_id) {
- const response = await vk.api.friends.get({
- user_id: user_id,
- fields: 'nickname,domain,sex,bdate,city,country,timezone,photo_50,photo_100,photo_200_orig,has_mobile,contacts, education,online,relation,last_seen,status,can_write_private_message,can_see_all_posts,can_post,universities',
- v: 5.92
- });
- global_arr.push(response.items)
- console.log('new friend')
- }
- async function my_friends(user_id) {
- const response = await vk.api.friends.get({
- user_id: user_id,
- v: 5.92
- });
- friends = response.items;
- for(var i in friends){
- setTimeout(run, 3000, friends[i])
- if(i === friends.length-1){
- fs.writeFile('myjsonfile.json', JSON.stringify(global_arr), 'utf8', () => {
- console.log('Успешно!')
- });
- }
- }
- }
- my_friends(your_id).catch(console.log);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement