-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathVKMessagesRestorer.py
More file actions
11 lines (9 loc) · 815 Bytes
/
VKMessagesRestorer.py
File metadata and controls
11 lines (9 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
from requests import get # pip install requests
from time import sleep
token = 'token'
last = get(f'https://api.vk.com/method/messages.send?peer_id={get(f'https://api.vk.com/method/account.getProfileInfo?access_token={token}&v=5.131').json()['response']['id']}&message=Test&random_id=0&access_token={token}&v=5.131').json()['response']
msgs = get(f'https://api.vk.com/method/messages.getById?message_ids={','.join([str(last-i) for i in range(100)])}&access_token={token}&v=5.131').json()['response']['items']
for msg in msgs:
if msg['out'] == 1 and 'deleted' in msg and msg['deleted'] == 1:
print(f'Восстанавливаю сообщение {msg["id"]}:', get(f'https://api.vk.com/method/messages.restore?message_id={msg["id"]}&access_token={token}&v=5.131').json())
sleep(0.5)