Commit c59454e5 authored by lixiaofang's avatar lixiaofang

add

parent eea8bad4
...@@ -32,8 +32,6 @@ if __name__ == "__main__": ...@@ -32,8 +32,6 @@ if __name__ == "__main__":
lenn = len(user_ids) lenn = len(user_ids)
print(lenn)
randoms_id = [] randoms_id = []
for i in range(lenn % 2): for i in range(lenn % 2):
...@@ -42,6 +40,7 @@ if __name__ == "__main__": ...@@ -42,6 +40,7 @@ if __name__ == "__main__":
randoms_id.append(user_ids[rand_num]) randoms_id.append(user_ids[rand_num])
if randoms_id: if randoms_id:
for i in randoms_id: for i in randoms_id:
time.sleep(random.randint(10, 50)) time.sleep(random.randint(10, 50))
......
...@@ -14,6 +14,8 @@ def write_id_file(): ...@@ -14,6 +14,8 @@ def write_id_file():
data = open("save_topic_id_three.txt", "r") data = open("save_topic_id_three.txt", "r")
for i in data.readlines(): for i in data.readlines():
user_ids.append(int(i.strip())) user_ids.append(int(i.strip()))
data = open("save_topic_id_three.txt", "w")
data.truncate() data.truncate()
return user_ids return user_ids
except: except:
...@@ -30,22 +32,23 @@ if __name__ == "__main__": ...@@ -30,22 +32,23 @@ if __name__ == "__main__":
lenn = len(user_ids) lenn = len(user_ids)
random = [] randoms_id = []
for i in range(lenn / 2): for i in range(lenn % 2):
rand_num = random.randint(0, lenn) rand_num = random.randint(0, len(user_ids) - 1)
random.append(lenn[rand_num]) randoms_id.append(user_ids[rand_num])
for i in random: if randoms_id:
time.sleep(random.randint(10,30)) for i in randoms_id:
cook = login() time.sleep(random.randint(10, 50))
if cook is not None: cook = login()
click(cook, i) if cook is not None:
click(cook, i)
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment