Commit 1625fbf1 authored by lixiaofang's avatar lixiaofang

add

parent ba05f067
This diff is collapsed.
......@@ -56,7 +56,7 @@ if __name__ == "__main__":
numtime1, numtime2 = time_convs(1, 1)
user_id = get_topic_new_user(numtime1,numtime2)
user_id = get_topic_new_user(numtime1, numtime2)
follow_num = random.randint(1, 2)
......
......@@ -54,9 +54,9 @@ if __name__ == "__main__":
for i in range(follow_num):
if user_id:
try:
for j in user_id:
for j in user_id and user_id:
id = int(j[0])
......@@ -67,8 +67,8 @@ if __name__ == "__main__":
if cookies is not None:
follow(cookies, id)
time.sleep(60)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -105,6 +105,8 @@ if __name__ == "__main__":
user_id = get_commnet_id(numtime1)
try:
for j in user_id and user_id:
id = int(j[0])
......@@ -119,6 +121,8 @@ if __name__ == "__main__":
if cookies is not None:
follow(cookies, id)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -46,6 +46,8 @@ if __name__ == "__main__":
for j in range(urge_num):
try:
for i in user_id and user_id:
cookies = get_cookies(i)
......@@ -56,6 +58,7 @@ if __name__ == "__main__":
if cook is not None:
follow(cook, i)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -10,12 +10,13 @@ from auto_request import login, time_convs, follow, click
from auto_request import host, user, db, passwd
def get_star_user_id(numtime):
def get_star_user_id(numtime1, numtime2):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT user_id,id FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time > '%s' " % numtime)
"SELECT user_id,id FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time > '%s' and create_time < '%s' " % (
numtime1, numtime2))
data = cursor.fetchall()
user_id_list = list(data)
logging.info("Database version : %s " % user_id_list)
......@@ -45,11 +46,11 @@ if __name__ == "__main__":
numtime1, numtime2 = time_convs(i + 1, i - 1)
user_topic_id = get_star_user_id(numtime1)
user_topic_id = get_star_user_id(numtime1,numtime2)
if user_topic_id:
try:
for j in user_topic_id:
for j in user_topic_id and user_topic_id:
id = int(j[1])
......@@ -63,6 +64,8 @@ if __name__ == "__main__":
if cookies is not None:
click(cookies, id)
except:
pass
user_id = get_star_user_id(numtime1)
......
......@@ -10,12 +10,13 @@ from auto_request import login, time_convs, Urge
from auto_request import host, user, db, passwd
def get_star_useid(numtime):
def get_star_useid(numtime1, numtime2):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time > '%s'" % numtime)
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time > '%s' and create_time < '%s'" % (
numtime1, numtime2))
data = cursor.fetchall()
user_id = list(data)
topic_id_list = []
......@@ -42,9 +43,11 @@ if __name__ == "__main__":
for i in time_list:
numtime1, numtime2 = time_convs(i + 1,i-1)
numtime1, numtime2 = time_convs(i + 1, i - 1)
user_id = get_star_useid(numtime1)
user_id = get_star_useid(numtime1,numtime2)
try:
for j in user_id and user_id:
......@@ -59,5 +62,8 @@ if __name__ == "__main__":
if cookies is not None:
Urge(cookies, id)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -11,12 +11,12 @@ from auto_request import host, user, db, passwd
import threading
def get_data(numtime):
def get_data(numtime1,numtime2):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time > '%s'" % numtime)
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time > '%s' and create_time < '%s'" % (numtime1,numtime2))
data = cursor.fetchall()
user_id = list(data)
......@@ -48,11 +48,12 @@ if __name__ == "__main__":
numtime1, numtime2 = time_convs(i + 1, i - 1)
user_id = get_data(numtime1)
user_id = get_data(numtime1,numtime2)
urge_num = random.randint(0, 2)
for i in range(urge_num):
try:
for j in user_id and user_id:
......@@ -64,5 +65,7 @@ if __name__ == "__main__":
if cookies is not None:
Urge(cookies, id)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -50,6 +50,8 @@ if __name__ == "__main__":
for j in range(2):
try:
for i in user_id and user_id:
time.sleep(random.randint(10, 15))
......@@ -58,12 +60,8 @@ if __name__ == "__main__":
if cook is not None:
Urge(cook, i)
sleep_time = random.randint(300, 540)
timer = threading.Timer(1, urge_user) # 首次启动
timer.start()
except:
pass
except:
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