Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import vkontakte
import sys
import ipdb
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
vk = vkontakte.API('4156636', 'wZXxeZIZVOBJMK9OyVVR')
ids = []
#ipdb.set_trace()
'''
j=document.createElement('script')
j.src='https://code.jquery.com/jquery-2.1.1.min.js'
head=document.getElementsByTagName('head')[0]
head.appendChild(j)
var likers = ''; jQuery('div.wk_likes_liker_row').each(function(){ likers+='\n' + $(this).attr('id').split('row')[1]; } ); console.log(likers);
'''
def get_profiles(ids):
profiles = vk.getProfiles(user_ids=','.join(ids), fields='sex, city')
for profile in profiles:
if profile['sex']==1 and profile.has_key('city'):
city_id = profile['city']
if city_id == 99:
print 'http://vk.com/id%s' % (profile['uid'],)
else:
pass
with open(sys.argv[1]) as f:
for line in f:
try:
id = line.split('\n')[0]
except:
continue
if len(ids)<1000:
ids.append(id)
else:
get_profiles(ids)
ids = [id]
get_profiles(ids)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment