Merge branch 'master' of github.com:AlekseyLobanov/gotohack

This commit is contained in:
Oleg Morozenkov
2016-02-21 14:51:41 +03:00
3 changed files with 94 additions and 0 deletions

22
all_good_ids.py Normal file
View File

@@ -0,0 +1,22 @@
#!/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))

39
full_group_list Normal file
View File

@@ -0,0 +1,39 @@
district_kents
moi_raen_18
po_rayonu
public35574958
nas.rayon
chanson_best
club41978736
publicvor
ceny_brat
truephilosophy
public42291448
bratva_vsegda_ryadom
bratzasestry
justformens
ceny_life
philosophy_brother
oo_brat_oo
public53664903
myzhskoi_style
public102976872
brat_feed
pa_canskye
ygapaem
zalipaay
brat_bratka777
club52395272
noooool
yavolna
duha.pacana
pacanskie2015
po.pacansky
tyt_co_cmislom
pa.cany
parnipy
public41324287
taz.reshaet
heartoftheman
tazysosnooly
vaz.club

33
group_ids_downloader.py Normal file
View File

@@ -0,0 +1,33 @@
#!/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]))