Advertisement
Guest User

unfriend.py

a guest
Oct 24th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. import requests
  2. import json
  3. import datetime
  4.  
  5. login = ''
  6. passwd = ''
  7.  
  8. AT = requests.get('https://oauth.vk.com/token?grant_type=password&client_id=3697615&client_secret=AlVXZFMUqyrnABp8ncuU&username=%s&password=%s&v=5.68' % (login, passwd)).json()['access_token']
  9. for i in range(2):
  10.     FR = requests.get('https://api.vk.com/method/friends.get?order=hints&count=5000&offset=%s&fields=last_seen,deactivated&name_case=nom&access_token=%s&v=5.68' % (str(i*5000), AT)).json()['response']['items']
  11.     for f in FR:
  12.         if 'deactivated' not in f:
  13.             delta = (datetime.datetime.now() - datetime.datetime.fromtimestamp(f['last_seen']['time'])).days
  14.             if delta > 188:
  15.                 print(str(datetime.datetime.now().strftime('%H:%M:%S'))+' ~ '+f['first_name']+ ' '+f['last_name']+' (lost '+str(delta)+' days ago) [id'+str(f['id'])+']')
  16.                 requests.get('https://api.vk.com/method/friends.delete?user_id=%s&access_token=%s&v=5.68' % (str(f['id']), AT))
  17.         else:
  18.             print(str(datetime.datetime.now().strftime('%H:%M:%S'))+' ~ '+f['first_name']+ ' '+f['last_name']+' ('+f['deactivated']+') [id'+str(f['id'])+']')
  19.             requests.get('https://api.vk.com/method/friends.delete?user_id=%s&access_token=%s&v=5.68' % (str(f['id']), AT))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement