我一直在编写一个Twitter python脚本,它一次可以释放10个人的关注度,它很有效,但它只是释放了我最近关注的账户。我需要改变这一点,使之不跟随我之前跟踪时间最长的帐户
def unfollow():
friendNames, followNames = [], []
try:
for friend in tweepy.Cursor(api.friends).items(10):
friendNames.append(friend.screen_name)
for follower in tweepy.Cursor(api.followers).items(10):
followNames.append(follower.screen_name)
except tweepy.RateLimitError:
print("You're getting an error")
friendset = set(friendNames)
followset = set(followNames)
not_fback = friendset.difference(followset)
for not_following in not_fback:
api.destroy_friendship(not_following)
print("Unfollowing: " + not_following)
unfollow()
目前没有回答
相关问题 更多 >
编程相关推荐