Clean up a bit
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
from os.path import join
|
||||
|
||||
all_ids = {}
|
||||
|
||||
for dirpath, dirnames, filenames in os.walk(sys.argv[1]):
|
||||
for f in filenames:
|
||||
fp = os.path.join(dirpath, f)
|
||||
for uid in open(fp):
|
||||
uid = int(uid)
|
||||
if uid in all_ids:
|
||||
all_ids[uid] += 1
|
||||
else:
|
||||
all_ids[uid] = 1
|
||||
|
||||
f_out = open(sys.argv[2],'w')
|
||||
f_out.write(json.dumps(all_ids))
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
group_ids_downloader.py VK_LOGIN VK_PASSWORD APP_ID INPUT_FILENAME
|
||||
where INPUT_FILENAME is file with one id of group per line
|
||||
'''
|
||||
import sys
|
||||
|
||||
import vk_api
|
||||
|
||||
def getIdsByGroup(group_id):
|
||||
ids = []
|
||||
res = vk.method("groups.getMembers", {"group_id":group_id,"count":1000})
|
||||
count = res['count'] - 1000
|
||||
ids += res['items']
|
||||
cur_offset = 1000
|
||||
while count > 0:
|
||||
res = vk.method("groups.getMembers", {"group_id":group_id,
|
||||
"count":1000,"offset":cur_offset, "sort":"id_asc"})
|
||||
count = count - 1000
|
||||
cur_offset += 1000
|
||||
ids += res['items']
|
||||
return ids
|
||||
|
||||
vk_login, vk_password = sys.argv[1], sys.argv[2]
|
||||
vk = vk_api.VkApi(vk_login, vk_password, app_id=sys.argv[3])
|
||||
|
||||
vk.authorization()
|
||||
|
||||
for group_id in open(sys.argv[4]):
|
||||
group_id = group_id.strip()
|
||||
good_ids = getIdsByGroup(group_id)
|
||||
open('out/' + str(group_id),'w').write('\n'.join([str(i) for i in good_ids]))
|
||||
|
Before Width: | Height: | Size: 167 KiB After Width: | Height: | Size: 167 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |