def check_bot_accounts():
api = get_api(key2[0], key2[1], key2[2], key2[3])
ids = []
try:
with open('..//bots.txt', 'r') as f:
for line in f:
ids.append(line.rstrip())
ids.append('\n')
os.remove('..//bots.txt')
with open('..//existing_bots_copy.txt', 'r') as f_read:
with open('..//bots.txt', 'w') as f_write:
f_write.write(''.join(ids))
for line in f_read:
user = api.get_user(line.rstrip())
print(line)
if not user.protected:
f_write.write(line)
except tweepy.TweepError:
f_read.close()
f_write.close()
评论列表
文章目录