Created
June 12, 2019 13:43
-
-
Save neko-neko-nyan/bb1571af4a5215792e4105b83ea29284 to your computer and use it in GitHub Desktop.
Поиск удаленных и заблокированных аккаунтов (собачек) vk.com серди участников группы или друзей пользователя
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
import sys | |
import time | |
TOKEN = None | |
CLID = "<ClientID приложения>" | |
def req(m, **args): | |
args["v"] = "5.64" | |
args["access_token"] = TOKEN | |
sys.stderr.write(m + "\n") | |
r = requests.get("https://api.vk.com/method/%s" % m, params=args) | |
r.raise_for_status() | |
r = r.json() | |
if "response" in r: | |
return r["response"] | |
raise RuntimeError(str(r)) | |
def init(): | |
global TOKEN | |
print("https://oauth.vk.com/authorize?client_id=%s&display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=335902&response_type=token&v=5.64" % CLID) | |
TOKEN = dict((i.split('=') for i in input().split('#')[-1].split("&")))["access_token"] | |
def find_dogs(uid): | |
for i in req("friends.get", fields="domain", user_id=uid)['items']: | |
if "deactivated" in i: | |
yield(i["id"], i["first_name"], i["last_name"]) | |
def find_dogs_g(gid): | |
x = 0 | |
while True: | |
for i in req("groups.getMembers", fields="domain", group_id=gid, offset=x*1000)['items']: | |
if "deactivated" in i: | |
yield(i["id"], i["first_name"], i["last_name"]) | |
else: | |
break | |
def find_dogs_all(*ids): | |
for v in ids: | |
x = req("utils.resolveScreenName", screen_name=v) | |
print("-------- %s %s (%s) --------" % (x['type'], v, x['object_id'])) | |
if x['type'] == "user": | |
ids = [] | |
for n in find_dogs(x['object_id']): | |
ids.append(str(n[0])) | |
print("%s - %s %s" % n) | |
print("javascript:[%s].forEach(function(i){ajax.post('al_friends.php',{act:'remove',mid:i,hash:cur.userHash})})" % ','.join(ids)) | |
else: | |
for n in find_dogs_g(x['object_id']): | |
print("%s - %s %s" % n) | |
print("-- W: No autoremove command for groups!") | |
init() | |
find_dogs_all("<Ссылки на пользователей и группы без vk.com/>") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment