Is it possible to get a list of participants in VK, who liked the photo in the album of the group, but is not a member of it, if I'm not the administrator of the group?
1 answer
Yes you can
Python example.
For it, you will need to install the vk_api library:
pip install vk_api If you have windows :
python.exe -m pip install vk_api Next you will need to create a script with the following source code:
#!/usr/bin/env python3 import vk_api vk = vk_api.VkApi(login='login', password='password') vk.auth() api = vk.get_api() def get_members(group_id): count = 1000 offset = 0 while count == 1000: res = api.groups.getMembers(count=1000, offset=1000*offset, group_id=group_id) count = res['count'] offset += 1 yield res['items'] def in_file(filename, user_id): with open(filename) as file: for line in file.readlines(): if user_id == line.strip(): return True return False likers = api.likes.getList(...) # см. комментарии после кода with open('temp.txt', 'w') as file: for line in get_members('<group_id>'): for one in line: file.write(str(one)+'\n') res = [] for liker in likers: if not in_file('temp.txt', str(liker)): res.append(liker) print(res) Parameters to getList look here .
|
vk.api, for example,likes.getListandgroups.getMembers, and already on the basis of the collections you can easily get yours - yolosora