Commit c3280c45 authored by lixiaofang's avatar lixiaofang

add

parent f9d86870
This diff is collapsed.
......@@ -4,25 +4,26 @@ import random
import traceback
from log_settings import *
import logging
from auto_request import login, click, time_convs, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, click, time_convs
from auto_request import host, user, db, passwd
def get_data(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
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 create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
topic_id = list(data)
user_list = get_user_id()
topic_id_list = []
if topic_id:
for i in topic_id:
if int(i[0]) not in user_list:
topic_id_list.append(i)
for i in topic_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
......
......@@ -5,8 +5,8 @@ import pymysql
import random
import traceback
import logging
from auto_request import login, click, time_convs, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, click, time_convs
from auto_request import host, user, db, passwd
def get_data(numtime):
......@@ -15,16 +15,17 @@ def get_data(numtime):
cursor = pc.cursor()
cursor.execute(
"SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' " % numtime)
"SELECT user_id , id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' " % numtime)
data = cursor.fetchall()
topic_id = list(data)
user_list = get_user_id()
topic_id_list = []
if topic_id:
for i in topic_id:
if int(i[0]) not in user_list:
topic_id_list.append(i)
for i in topic_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
......
......@@ -7,8 +7,8 @@ import traceback
import logging
from log_settings import *
from auto_request import login, time_convs, reply, get_comment, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, time_convs, reply, get_comment
from auto_request import host, user, db, passwd
def get_topic_id(numtime):
......@@ -16,19 +16,19 @@ def get_topic_id(numtime):
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 create_time LIKE '%%%%%s%%%%' " % numtime
# "select id,user_id from topic where user_id = 241529801 or id = 241529809"
"SELECT id,user_id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' " % numtime
)
data = cursor.fetchall()
topic_id = list(data)
logging.info("Database version : %s " % topic_id)
user_list = get_user_id()
topic_id_list = []
if topic_id:
for i in topic_id:
if int(i[0]) not in user_list:
topic_id_list.append(i)
for i in topic_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
......
......@@ -24,17 +24,22 @@ def get_topic_new_user(numtime):
topic_data = list(topic_data)
new_user_data = list(new_user_data)
user_list = get_user_id()
topic_id_list = []
if topic_data:
for i in topic_data:
if int(i) in user_list:
topic_id_list.append(i)
if new_user_data:
for i in new_user_data:
if i in user_list:
topic_id_list.append(i)
for i in topic_data:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
for i in new_user_data:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
......
......@@ -6,27 +6,26 @@ import random
import traceback
from log_settings import *
import logging
from auto_request import login, time_convs, follow,get_user_id
from auto_request import login, time_convs, follow
from auto_request import host, user, port, db, passwd
def get_data(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
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 LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
user_list = get_user_id()
topic_id_list = []
if user_id:
for i in user_id:
if int(i[0]) not in user_list:
topic_id_list.append(i)
for i in user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
id = list(data)
if id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
......@@ -62,10 +61,8 @@ if __name__ == "__main__":
cookies = login()
if cookies is not None:
follow(cookies, id)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -6,12 +6,12 @@ import random
import traceback
from log_settings import *
import logging
from auto_request import login, time_convs, follow, get_user_id
from auto_request import login, time_convs, follow
from auto_request import host, user, port, db, passwd
def get_commnet_id(numtime):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
......@@ -47,41 +47,62 @@ def get_commnet_id(numtime):
data1_id = list(data_reply_topic)
data2_id = list(data_group_follow)
data3_id = list(data_new_user)
data_reply_reply = list(data_reply_reply)
user_list = get_user_id()
user_id = []
data_reply = list(data_reply_reply)
topic_id_list = []
for i in data_id:
if i[0] is not None:
if int(i[0]) not in user_list:
user_id.append(i)
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
for i in data1_id:
if i[0] is not None:
if int(i[0]) not in user_list:
user_id.append(i)
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
for i in data2_id:
if i[0] is not None:
if int(i[0]) not in user_list:
user_id.append(i)
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
for i in data3_id:
if i[0] is not None:
if int(i[0]) not in user_list:
user_id.append(i)
for i in data_reply_reply:
if i[0] is not None:
if int(i[0]) not in user_list:
user_id.append(i)
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % user_id)
for i in data1_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
for i in data_reply:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return user_id
return topic_id_list
if __name__ == "__main__":
......
......@@ -6,13 +6,13 @@ import random
import traceback
from log_settings import *
import logging
from auto_request import login, time_conv, follow, get_cookies, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, time_conv, follow, get_cookies
from auto_request import host, user, db, passwd
def get_data(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"select distinct(user_id) from account_user_auth where user_id not in (select user_id from pv_maidian where page_name ='home' and partiton_date >= %s )",
......@@ -20,12 +20,14 @@ def get_data(numtime):
data = cursor.fetchall()
user_id = list(data)
user_list = get_user_id()
topic_id_list = []
if user_id:
for i in user_id:
if int(i) not in user_list:
topic_id_list.append(i)
for i in user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
......
......@@ -6,24 +6,27 @@ import random
import traceback
from log_settings import *
import logging
from auto_request import login, time_convs, follow, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, time_convs, follow
from auto_request import host, user, db, passwd
def get_data(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"select distinct(user_id) from pv_maidian where page_name ='home' and partiton_date like '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
user_list = get_user_id()
topic_id_list = []
if user_id:
for i in user_id:
if int(i) not in user_list:
topic_id_list.append(i)
for i in user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.pcinfo("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
......
......@@ -132,7 +132,6 @@ def time_conv(minutest):
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(minutes=minutest)
print(yes_time)
return yes_time
except:
......@@ -144,7 +143,7 @@ def time_convs(numtime):
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=numtime)
yes_time_str = yes_time.strftime('%Y-%m-%d')
return yes_time_str
return yes_time
except:
return None
......
......@@ -6,26 +6,26 @@ import random
import traceback
from log_settings import *
import logging
from auto_request import login, time_conv, follow, click, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, time_conv, follow, click
from auto_request import host, user, db, passwd
def get_star_user_id(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
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 LIKE '%%%%%s%%%%' " % numtime)
data = cursor.fetchall()
user_id = list(data)
user_list = get_user_id()
topic_id_list = []
if user_id:
for i in user_id:
if int(i[0]) not in user_list:
topic_id_list.append(i)
for i in user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
......
......@@ -7,26 +7,26 @@ import pandas as pd
import traceback
from log_settings import *
import logging
from auto_request import login, time_conv, Urge, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, time_conv, Urge
from auto_request import host, user, db, passwd
def get_star_useid(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
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 LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
user_list = get_user_id()
topic_id_list = []
if user_id:
for i in user_id:
if int(i) not in user_list:
topic_id_list.append(i)
for i in user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
......@@ -58,7 +58,6 @@ if __name__ == "__main__":
cookies = login()
if cookies is not None:
Urge(cookies, id)
except:
......
......@@ -7,26 +7,28 @@ import pandas as pd
import traceback
from log_settings import *
import logging
from auto_request import login, time_conv, Urge, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, time_conv, Urge
from auto_request import host, user, db, passwd
import threading
def get_data(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
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 LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
user_list = get_user_id()
topic_id_list = []
if user_id:
for i in user_id:
if int(i) not in user_list:
topic_id_list.append(i)
for i in user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
......
......@@ -8,26 +8,27 @@ from log_settings import *
import logging
import threading
from auto_request import login, time_conv, Urge, get_user_id
from auto_request import host, user, port, db, passwd
from auto_request import login, time_conv, Urge
from auto_request import host, user, db, passwd
def get_data(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"select distinct(user_id) from account_user_auth where user_id not in (select user_id from pv_maidian where page_name ='home' and partiton_date >= %s)",
(numtime))
data = cursor.fetchall()
user_id = list(data)
user_list = get_user_id()
topic_id_list = []
if user_id:
for i in user_id:
if int(i[1]) not in user_list:
topic_id_list.append(i)
for i in user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
......
......@@ -35,3 +35,4 @@ for i in data:
......@@ -43,7 +43,7 @@ if __name__ == "__main__":
global exec_count
exec_count += 1
if exec_count == 1:
if exec_count == 2:
print("----1------")
sleep_time = random.randint(300, 540)
sleep_time = 30
......@@ -76,7 +76,7 @@ if __name__ == "__main__":
timer = threading.Timer(sleep_time, fun_timer)
timer.start()
if exec_count == 2:
if exec_count == 5:
print("----4------")
# sleep_time = random.randint(1000, 1900)
......
......@@ -4,7 +4,7 @@ import random
from log_settings import *
import traceback
import logging
from auto_request import get_offline_comment,get_user_id
from auto_request import get_offline_comment
from auto_request import host, user, db, passwd
auto_reply_url = "http://47.93.162.11:8085/api/v1/reply/create_for_inner"
......@@ -19,8 +19,6 @@ auto_reply_url = "http://47.93.162.11:8085/api/v1/reply/create_for_inner"
# 注意需要禁止本帖作者评论
def reply(id, content, user_id):
try:
post_dict = {
......@@ -42,20 +40,19 @@ def get_data(num1, num2):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
print(num1)
print(num2)
print("--------")
cursor.execute(
"SELECT id,user_id FROM topic WHERE is_online =1 and (id > " + str(num1) + " and id <= " + str(
num2) + ") and (content_level = 4 or content_level = 5) ")
data = cursor.fetchall()
topic_id = list(data)
user_list = get_user_id()
topic_id_list = []
if topic_id:
for i in topic_id:
if int(i[1]) in user_list:
topic_id_list.append(i)
for i in topic_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =1")
cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
pc.close()
logging.info("get topic_id_list:%s" % topic_id_list)
return topic_id_list
......@@ -68,7 +65,8 @@ if __name__ == "__main__":
try:
time_list = [[0, 100000], [100000, 200000], [200000, 300000], [300000, 400000], [400000, 500000],[500000, 600000],[600000, 700000]]
time_list = [[0, 100000], [100000, 200000], [200000, 300000], [300000, 400000], [400000, 500000],
[500000, 600000], [600000, 700000]]
user_data = open("user_id.txt", "r")
......
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