Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import json
- import datetime
- login = ''
- passwd = ''
- 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']
- for i in range(2):
- 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']
- for f in FR:
- if 'deactivated' not in f:
- delta = (datetime.datetime.now() - datetime.datetime.fromtimestamp(f['last_seen']['time'])).days
- if delta > 188:
- print(str(datetime.datetime.now().strftime('%H:%M:%S'))+' ~ '+f['first_name']+ ' '+f['last_name']+' (lost '+str(delta)+' days ago) [id'+str(f['id'])+']')
- requests.get('https://api.vk.com/method/friends.delete?user_id=%s&access_token=%s&v=5.68' % (str(f['id']), AT))
- else:
- print(str(datetime.datetime.now().strftime('%H:%M:%S'))+' ~ '+f['first_name']+ ' '+f['last_name']+' ('+f['deactivated']+') [id'+str(f['id'])+']')
- 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