Javascript 计算此Python代码中未跟随者数的数量时出错
我已经为在instagram上释放追随者(非追随者)编写了这段代码,但该脚本的计数似乎是错误的。 例如:几乎有1000个无追随者(非追随者),但脚本显示了210个或一些随机数字Javascript 计算此Python代码中未跟随者数的数量时出错,javascript,python,python-2.7,python-3.x,Javascript,Python,Python 2.7,Python 3.x,我已经为在instagram上释放追随者(非追随者)编写了这段代码,但该脚本的计数似乎是错误的。 例如:几乎有1000个无追随者(非追随者),但脚本显示了210个或一些随机数字 from InstagramAPI import InstagramAPI from time import sleep from datetime import datetime USERNAME = '' # put your username between the quotes PASSWORD = ''
from InstagramAPI import InstagramAPI
from time import sleep
from datetime import datetime
USERNAME = '' # put your username between the quotes
PASSWORD = '' # put your password between the quotes
SUCESSIVE_UNFOLLOWS_BETWEEN = 30 # enter time in seconds for time between two unfollows
UNFOLLOW_BATCH = 100 # enter how much unfollow in one batch
TIME_BETWEEN_BATCHES = 3600 # enter time in seconds for time difference between two unfollows
def get_to_unfollow_list(object):
following_list = []
for user in object.getSelfUsersFollowing()['users']:
following_list.append(user['pk'])
follower_list = []
for user in object.getSelfUserFollowers()['users']:
follower_list.append(user['pk'])
not_following_me = list(set(following_list) - set(follower_list))
return not_following_me
if __name__ == '__main__':
inst = InstagramAPI(USERNAME, PASSWORD)
inst.login()
first= True
firstBatch = True
while True:
if not first:
sleep(86400)
else:
first = True
to_unfollow_list = get_to_unfollow_list(inst)
while len(to_unfollow_list) > 0:
if firstBatch:
firstBatch = False
else:
pass
sleep(TIME_BETWEEN_BATCHES)
for no, id in enumerate(to_unfollow_list[0:UNFOLLOW_BATCH]):
name = inst.getUsernameInfo(id)
sleep(SUCESSIVE_UNFOLLOWS_BETWEEN - 5)
try:
inst.unfollow(id)['user']['username']
except:
pass
print("Unfollowed #" + str(no + 1) + " " + name)
sleep(5)
print("Completed Unfollowing " + str(UNFOLLOW_BATCH) + " unfollowers in " + str(TIME_BETWEEN_BATCHES) + " seconds.")
try:
del to_unfollow_list[:UNFOLLOW_BATCH]
except:
pass
print("Completed Unfollowing " + str(len(to_unfollow_list)) + " unfollowers in 1 Hour/Minutes.")
print("Todays task is completed! Unfollowed " + str(len(to_unfollow_list)) + " followers today (" + str(datetime.now().date()) + ")")
请注意,有一个API文件还包括:
请帮助我解决此问题。…您的try-except语句中可能缺少一些重要的调试信息。只在您试图捕获的特定错误中使用它。谢谢,但我正在寻求有关修改的帮助。