import urllib2
import json
listNames = open('list.txt', 'r')
ans = open('ans.txt', 'w')
a = ''
ls = []
for s in listNames :
s = s[0:len(s) - 1]
if(len(a) > 0) :
a += ';'
a += s
ls.append(s)
if(len(ls) == 500) :
data = json.load(urllib2.urlopen('http://c...content-available-to-author-only...s.com/api/user.info?handles=' + a))
for i in range(len(ls)) :
ans.write(ls[i])
ans.write(' ' + str(data[u'result'][i][u'friendOfCount']) + '\n')
ls = []
a = ''
if(len(ls) > 0) :
data = json.load(urllib2.urlopen('http://c...content-available-to-author-only...s.com/api/user.info?handles=' + a))
for i in range(len(ls)) :
ans.write(ls[i])
ans.write(' ' + str(data[u'result'][i][u'friendOfCount']) + '\n')
aW1wb3J0IHVybGxpYjIKaW1wb3J0IGpzb24KCmxpc3ROYW1lcyA9IG9wZW4oJ2xpc3QudHh0JywgJ3InKQphbnMgPSBvcGVuKCdhbnMudHh0JywgJ3cnKQoKYSA9ICcnCmxzID0gW10KZm9yIHMgaW4gbGlzdE5hbWVzIDoKCXMgPSBzWzA6bGVuKHMpIC0gMV0KCglpZihsZW4oYSkgPiAwKSA6IAoJCWEgKz0gJzsnCglhICs9IHMKCWxzLmFwcGVuZChzKQoKCWlmKGxlbihscykgPT0gNTAwKSA6CgkJZGF0YSA9IGpzb24ubG9hZCh1cmxsaWIyLnVybG9wZW4oJ2h0dHA6Ly9jLi4uY29udGVudC1hdmFpbGFibGUtdG8tYXV0aG9yLW9ubHkuLi5zLmNvbS9hcGkvdXNlci5pbmZvP2hhbmRsZXM9JyArIGEpKQoJCWZvciBpIGluIHJhbmdlKGxlbihscykpIDoKCQkJYW5zLndyaXRlKGxzW2ldKQoJCQlhbnMud3JpdGUoJyAnICsgc3RyKGRhdGFbdSdyZXN1bHQnXVtpXVt1J2ZyaWVuZE9mQ291bnQnXSkgKyAnXG4nKQoJCgkJbHMgPSBbXQoJCWEgPSAnJwoKaWYobGVuKGxzKSA+IDApIDoKCWRhdGEgPSBqc29uLmxvYWQodXJsbGliMi51cmxvcGVuKCdodHRwOi8vYy4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4ucy5jb20vYXBpL3VzZXIuaW5mbz9oYW5kbGVzPScgKyBhKSkKCWZvciBpIGluIHJhbmdlKGxlbihscykpIDoKCQlhbnMud3JpdGUobHNbaV0pCgkJYW5zLndyaXRlKCcgJyArIHN0cihkYXRhW3UncmVzdWx0J11baV1bdSdmcmllbmRPZkNvdW50J10pICsgJ1xuJykK