SHARE
TWEET

Untitled

a guest Mar 24th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var {VK} = require('vk-io');
  2. var fs = require('fs');
  3.  
  4. const vk = new VK();
  5.  
  6. var friends = [], global_arr = [];
  7.  
  8. vk.token = ""
  9. var your_id = 90327755
  10.  
  11. async function run(user_id) {
  12.     const response = await vk.api.friends.get({
  13.         user_id: user_id,
  14.         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',
  15.         v: 5.92
  16.     });
  17.     global_arr.push(response.items)
  18.     console.log('new friend')
  19. }
  20.  
  21. async function my_friends(user_id) {
  22.   const response = await vk.api.friends.get({
  23.       user_id: user_id,
  24.       v: 5.92
  25.   });
  26.   friends = response.items;
  27.   for(var i in friends){
  28.     setTimeout(run, 3000, friends[i])
  29.     if(i === friends.length-1){
  30.       fs.writeFile('myjsonfile.json', JSON.stringify(global_arr), 'utf8', () => {
  31.         console.log('Успешно!')
  32.       });
  33.     }
  34.   }
  35. }
  36.  
  37. my_friends(your_id).catch(console.log);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top