Commit e9cd8e22 authored by lixiaofang's avatar lixiaofang

update

parent 7a803ecb
File added
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" /> <orderEntry type="jdk" jdkName="Python 3.6 (code)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module> </module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Encoding"> <component name="Encoding">
<file url="file://$PROJECT_DIR$/auto_commnet.py" charset="GBK" />
<file url="file://$PROJECT_DIR$/comment_data" charset="GBK" /> <file url="file://$PROJECT_DIR$/comment_data" charset="GBK" />
<file url="file://$PROJECT_DIR$/comment_data.csv" charset="GBK" />
</component> </component>
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (code)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
This diff is collapsed.
马甲server 马甲server
import requests
import time
import datetime
import pymysql
import random
import pandas as pd
cookies = {
"sessionid": '1',
}
auto_click_url = "http://earth.igengmei.com/api/v1/like"
auto_click_url = "http://earth.igengmei.com/api/v1/reply/create"
auto_follow_url = "http://earth.igengmei.com/api/v1/follow"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
def index_first():
r1=requests.get(login_url)
return r1.cookies.get_dict()
def login(cookies,user,pwd):
post_dict={
'account_type':user,
'pwd':pwd
}
response=requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
print(response.text,'url')
def follow(cookies_get, id):
post_dict = {
'type': 1,
'id': id
}
response = requests.post(url=auto_follow_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
def dz(cookies_get, id):
post_dict = {
'type': 1,
'id': id
}
response = requests.post(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
def reply(cookies_get,id,content):
post_dict={
'topic_id':id,
'content':content
}
response=requests.get(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
def time_conv():
now = datetime.datetime.now()
yes_time_str=now.strftime('%Y-%m-%d')
return yes_time_str
def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
print("---------")
cursor.execute("SELECT id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
print("Database version : %s " % user_id)
db.close()
return user_id
def get_comment():
data = pd.read_csv("guanshui", sep='\n')
num = random.randint(0, len(data))
list_guanshui = []
for i in data['comment scene']:
l = i.split('\t')
list_guanshui.append(l[0])
comment = list_guanshui[num]
return comment
if __name__ == "__main__":
numtime=time_conv()
user_id = get_data(numtime)
for j in user_id:
id = int(j[0])
num = random.randint(0,2)
if num == 0:
# user_id=majia[num]
cookies = index_first()
login(cookies,user=cookies,pwd='')
comment = get_comment()
reply(cookies, id, comment)
if num == 1:
# user_id=majia[num]
cookies = index_first()
login(cookies,user=cookies,pwd='')
dz(cookies, id)
comment = get_comment()
reply(cookies, id, comment)
#1. 发帖瞬时:[0-1]个马甲点赞
# 1. 用户发帖后,[瞬时],什么也不做,担心用户要互动就穿帮 评论
...@@ -38,7 +38,6 @@ def login(cookies,user,pwd): ...@@ -38,7 +38,6 @@ def login(cookies,user,pwd):
) )
print(response.text, 'url') print(response.text, 'url')
def dz(cookies_get, id): def dz(cookies_get, id):
post_dict = { post_dict = {
'type': 1, 'type': 1,
...@@ -50,16 +49,6 @@ def dz(cookies_get, id): ...@@ -50,16 +49,6 @@ def dz(cookies_get, id):
print(response.text, 'url') print(response.text, 'url')
content = response.text
# list= []
# for i in content[0].strip('{}').split(','):
# for j in i.split(':'):
# list.append(j)
# if list[1]==' 1':
# print('click error ')
def time_conv(numtime): def time_conv(numtime):
now = datetime.datetime.now() now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=numtime) yes_time = now - datetime.timedelta(days=numtime)
...@@ -67,7 +56,6 @@ def time_conv(numtime): ...@@ -67,7 +56,6 @@ def time_conv(numtime):
print(now) print(now)
return yes_time_str return yes_time_str
def get_data(numtime): def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306) db="alpha", port=3306)
...@@ -81,68 +69,13 @@ def get_data(numtime): ...@@ -81,68 +69,13 @@ def get_data(numtime):
return user_id return user_id
def get_star_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
print("---------")
cursor.execute(
"SELECT id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
print("Database version : %s " % user_id)
db.close()
return user_id
def one_zero():
user_list=[1,2,3,4,5,6,7,8]
time_list = [1, 3, 5, 7, 15, 21, 28, 35]
return time_list,user_list
sleep_time=[]
for i in range(1,10):
sleep_time.append(random.randint(1800,3500))
return sleep_time,time_list,user_list
def one_two():
user_list = [1, 2, 3, 4, 5, 6, 7, 8]
time_list = [3,7]
sleep_time = []
for i in range(1, 3):
sleep_time.append(random.randint(3500, 7200))
return sleep_time, time_list, user_list
if __name__ == "__main__": if __name__ == "__main__":
time_list = [1, 3, 5,7,15,21,28,35]
sleep_time,time_list,user_list=one_zero() for i in range(len(time_list)):
for i in range(0,9): time.sleep(random.randint(3000,4500))
time.sleep(sleep_time[i])
numtime = time_conv(time_list[i]) numtime = time_conv(time_list[i])
...@@ -152,26 +85,15 @@ if __name__ == "__main__": ...@@ -152,26 +85,15 @@ if __name__ == "__main__":
id = int(j[0]) id = int(j[0])
# cookies = index_first() time.sleep(random.randint(200,500))
# login(cookies,user=cookies,pwd='')
dz(cookies, id)
sleep_time, time_list, user_list = one_two() num_cishu = random.randint(0, 1)
for i in range(1, 3): if num_cishu == 1:
time.sleep(sleep_time[i]) num_majia = random.randint(0, 300)
numtime = time_conv(time_list[i]) #user_id=majia[num]
user_id = get_star_data(numtime)
for j in user_id:
id = int(j[0])
# cookies = index_first() # cookies = index_first()
...@@ -180,27 +102,3 @@ if __name__ == "__main__": ...@@ -180,27 +102,3 @@ if __name__ == "__main__":
dz(cookies, id) dz(cookies, id)
# 1. 发帖瞬时:[0-1]个马甲点赞
#
# 2. 每日一次轮询,找每个昨日新增帖:[0-1]个马甲点赞
#
# 4. 每日一次轮询,3日前新增帖子:[0-1]个马甲点赞
#
# 5. 每日一次轮询,5日前新增帖子:[0-1]个马甲点赞
#
# 6. 每日一次轮询,7日前新增帖子:[0-1]个马甲点赞
#
# 7. 每日一次轮询,15日前新增帖子:[0-1]个马甲点赞
#
# 8. 每日一次轮询,21日前新增帖子:[0-1]个马甲点赞
#
# 9. 每日一次轮询,28日前新增帖子:[0-1]个马甲点赞
#
# 10. 每日一次轮询,35日前新增帖子:[0-1]个马甲点赞
# 3. 每日一次轮询,昨日被选为4、5星的帖子:[1-5]个马甲点赞
#
# 3. 每日一次轮询,3日前被选为4、5星的帖子:[1-2]个马甲点赞
#
# 3. 每日一次轮询,7日前被选为4、5星的帖子:[1-2]个马甲点赞
\ No newline at end of file
import requests
import time
import datetime
import pymysql
import random
import pandas as pd
cookies = {
"sessionid": '1',
}
s = requests.session()
s.keep_alive = False
requests.adapters.DEFAULT_RETRIES = 5
auto_follow_url = "http://earth.igengmei.com/api/v1/follow"
auto_click_url = "http://earth.igengmei.com/api/v1/like"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
auto_urge_url = "http://earth.igengmei.com/api/v1/user/urge"
auto_click_url = "http://earth.igengmei.com/api/v1/pick/do_pick"
def index_first():
r1=requests.get(login_url)
return r1.cookies.get_dict()
def login(cookies,user,pwd):
post_dict={
'account_type':user,
'pwd':pwd
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
print(response.text, 'url')
def dz(cookies_get, id):
post_dict = {
'type': 1,
'id': id
}
response = requests.post(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
def follow(cookies_get, id):
post_dict = {
'type': 1,
'id': id
}
response = requests.post(url=auto_follow_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
def Urge(cookies_get, id):
post_dict = {
'id': id
}
response = requests.post(url=auto_urge_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
def pick(cookies_get,id):
post_dict={
'pick_user_id':id,
'is_pick':1,
'pick_type':0
}
response=requests.get(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
def time_conv(numtime):
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=numtime)
yes_time_str = yes_time.strftime('%Y-%m-%d')
print(now)
return yes_time_str
def get_star_userid(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT user_id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
print("Database version : %s " % user_id)
db.close()
return user_id
def get_star_tieid(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
print("Database version : %s " % user_id)
db.close()
return user_id
if __name__ == "__main__":
time_list = [1, 3, 7,10]
for num in time_list:
numtime = time_conv(num)
if num == 1:
user_id = get_star_tieid(numtime)
for i in user_id:
num_cishu = random.randint(1, 5)
for j in range(num_cishu):
time.sleep(random.randint(300,400))
num_tieid = random.randint(1,300)
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
dz(cookies, id)
elif num==3 or num == 7:
user_id = get_star_tieid(numtime)
for i in user_id:
num_cishu = random.randint(1, 2)
for j in range(num_cishu):
time.sleep(random.randint(300, 400))
num_tieid = random.randint(1, 300)
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
dz(cookies, id)
else:
user_id=get_star_userid(numtime)
for i in user_id:
num_cishu = random.randint(1, 5)
for j in range(num_cishu):
time.sleep(random.randint(300, 400))
num_userid = random.randint(1, 300)
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
follow(cookies, id)
Urge(cookies,id)
pick(cookies,id)
...@@ -3,6 +3,8 @@ import time ...@@ -3,6 +3,8 @@ import time
import datetime import datetime
import pymysql import pymysql
import random import random
import pandas as pd
cookies = { cookies = {
"sessionid": '1', "sessionid": '1',
...@@ -31,7 +33,7 @@ def login(cookies,user,pwd): ...@@ -31,7 +33,7 @@ def login(cookies,user,pwd):
data=post_dict, data=post_dict,
cookies=cookies cookies=cookies
) )
print(response.text,'url') # print(response.text,'url')
def reply(cookies_get,id,content): def reply(cookies_get,id,content):
...@@ -51,7 +53,6 @@ def time_conv(numtime): ...@@ -51,7 +53,6 @@ def time_conv(numtime):
now = datetime.datetime.now() now = datetime.datetime.now()
yes_time = now -datetime.timedelta(days=numtime) yes_time = now -datetime.timedelta(days=numtime)
yes_time_str=yes_time.strftime('%Y-%m-%d') yes_time_str=yes_time.strftime('%Y-%m-%d')
print(now)
return yes_time_str return yes_time_str
...@@ -59,60 +60,57 @@ def get_data(numtime): ...@@ -59,60 +60,57 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306) db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
cursor = db.cursor() cursor = db.cursor()
print("---------") # print("---------")
cursor.execute("SELECT id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" %numtime) cursor.execute("SELECT id FROM topic WHERE create_time LIKE '%%%%%s%%%%' " %numtime)
data = cursor.fetchall() data = cursor.fetchall()
user_id = list(data) user_id = list(data)
print("Database version : %s " % user_id) # print("Database version : %s " % user_id)
db.close() db.close()
return user_id return user_id
if __name__ == "__main__":
sleep_time=[]
for i in range(0,6): def get_comment():
sleep_time.append(random.randint(1800,3500)) data = pd.read_csv("guanshui", sep='\n')
num = random.randint(0, len(data))
list_guanshui = []
for i in data['comment scene']:
l = i.split('\t')
list_guanshui.append(l[0])
for i in sleep_time: comment = list_guanshui[num]
time.sleep(i) return comment
time_list=[1,3,5,7]
for i in time_list: if __name__ == "__main__":
numtime=time_conv(i) time_list = [1, 3, 5, 7]
user_id=get_data(numtime) for i in range(len(time_list)):
for j in user_id: time.sleep(random.randint(5000,6500))
id=int(j[0]) numtime = time_conv(time_list[i])
cookies=index_first() user_id = get_data(numtime)
login(cookies,user=cookies,pwd='') for j in user_id:
id = int(j[0])
time.sleep(random.randint(300,700))
comment="太好看了!" num_majia = random.randint(0, 300)
id = 1 #user_id=majia[num]
reply(cookies,id,comment) # cookies = index_first()
# login(cookies,user=cookies,pwd='')
comment = get_comment()
reply(cookies, id, comment)
# 1. 用户发帖后,[瞬时],什么也不做,担心用户要互动就穿帮
#
# 2. 每日一次轮询,找每个昨日新增帖:随机从马甲库里取一个马甲,搭配随机评论库一条评论
#
# 3. 每日一次轮询,3日前新增帖子:随机从马甲库里取一个马甲,搭配随机评论库一条评论
#
# 4. 每日一次轮询,5日前新增帖子:随机从马甲库里取一个马甲,搭配随机评论库一条评论
#
# 5. 每日一次轮询,7日前新增帖子:随机从马甲库里取一个马甲,搭配随机评论库一条评论
...@@ -48,15 +48,6 @@ def follow(cookies_get, id): ...@@ -48,15 +48,6 @@ def follow(cookies_get, id):
print(response.text, 'url') print(response.text, 'url')
content = response.text
# list= []
# for i in content[0].strip('{}').split(','):
# for j in i.split(':'):
# list.append(j)
# if list[1]==' 1':
# print('click error ')
def time_conv(numtime): def time_conv(numtime):
now = datetime.datetime.now() now = datetime.datetime.now()
...@@ -72,51 +63,23 @@ def get_data(numtime): ...@@ -72,51 +63,23 @@ def get_data(numtime):
cursor = db.cursor() cursor = db.cursor()
print("---------") print("---------")
cursor.execute("SELECT id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime) cursor.execute("SELECT user_id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall() data = cursor.fetchall()
# cursor.execute("SELECT id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
# data = cursor.fetchall()
user_id = list(data) user_id = list(data)
print("Database version : %s " % user_id) print("Database version : %s " % user_id)
db.close() db.close()
return user_id return user_id
#(0-1)
def get_star_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
print("---------")
cursor.execute(
"SELECT id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
print("Database version : %s " % user_id)
db.close()
return user_id
def get_commnet_id(numtime): def get_commnet_id(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306) db="alpha", port=3306)
cursor = db.cursor() cursor = db.cursor()
print("---------")
cursor.execute( cursor.execute(
"SELECT user_id FROM reply WHERE create_time LIKE '%%%%%s%%%%'" % numtime) "SELECT user_id FROM reply WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
...@@ -137,26 +100,14 @@ def get_commnet_id(numtime): ...@@ -137,26 +100,14 @@ def get_commnet_id(numtime):
data_new_user = cursor.fetchall() data_new_user = cursor.fetchall()
cursor.execute(
"select user_id,follow_id from user_follow WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_majia_follow = cursor.fetchall()
data_id = list(data_comment) data_id = list(data_comment)
data1_id=list(data_reply) data1_id=list(data_reply)
data2_id=list(data_group_follow) data2_id=list(data_group_follow)
data3_id=list(data_new_user) data3_id=list(data_new_user)
data4_id=list(data_majia_follow)
majia_list=[]
user_id = [] user_id = []
for i in majia_list:
for j in data4_id:
if i == j[0]:
user_id.append(j[1])
for i in data_id: for i in data_id:
user_id.append(i) user_id.append(i)
for i in data1_id: for i in data1_id:
...@@ -175,28 +126,29 @@ def get_commnet_id(numtime): ...@@ -175,28 +126,29 @@ def get_commnet_id(numtime):
if __name__ == "__main__": if __name__ == "__main__":
sleep_time=[] time_list = [1, 2, 7, 30,5]
flag = 0 for i in range(len(time_list)):
for i in range(0,11):
sleep_time.append(random.randint(1800,3500)) if time_list[i] ==5:
for i in sleep_time: numtime = time_conv(time_list[1])
time.sleep(i) user_id = get_commnet_id(numtime)
if flag == 0: for j in user_id:
numtime=time_conv(1) id = int(j[0])
user_id = get_star_data(numtime) num_cishu = random.randint(0,1)
# 1-5 fensi for i in range(num_cishu):
for j in user_id: time.sleep(random.randint(300, 500))
num_majia = random.randint(300)
id= int(j[0]) # user_id=majia[num]
# cookies = index_first() # cookies = index_first()
...@@ -204,10 +156,11 @@ if __name__ == "__main__": ...@@ -204,10 +156,11 @@ if __name__ == "__main__":
follow(cookies, id) follow(cookies, id)
time.sleep(random.randint(2000,2500))
time_list = [1, 2, 7, 30] else:
numtime = time_conv(time_list[flag]) numtime = time_conv(time_list[i])
user_id = get_data(numtime) user_id = get_data(numtime)
...@@ -215,48 +168,24 @@ if __name__ == "__main__": ...@@ -215,48 +168,24 @@ if __name__ == "__main__":
id = int(j[0]) id = int(j[0])
# cookies = index_first() num_cishu = random.randint(1,2)
# login(cookies,user=cookies,pwd='')
follow(cookies, id)
flag += 1 for i in range(num_cishu):
time.sleep(random.randint(300, 500))
user_id=get_commnet_id(1) num_majia = random.randint(300)
#user_id=majia[num]
# cookies = index_first()
# 注册 # login(cookies,user=cookies,pwd='')
# 1. 每日一次轮询,给每个昨日新注册用户加粉:[0-1]个粉丝
# 启动***********
# 1. 每日一次轮询,昨日启动 即触发加粉策略:[0-1]个粉丝
# 评论
# 1. 昨日有收到评论的用户:[0-1]个粉丝
#
# 2. 昨日有发出评论的用户:[0-1]个粉丝
# 加组
# 1. 昨日加组的用户:[0-1]个粉丝
# 关注
# 如果马甲被关注,即刻 反向 关注用户 5min后
follow(cookies, id)
time.sleep(random.randint(2000, 3000))
# 发帖
# 1. 每日一次轮询,昨日发帖的用户:[1-2]个粉丝
#
# 2. 每日一次轮询,2日前发帖的用户:[1-2]个粉丝
#
# 3. 每日一次轮询,7日前发帖的用户:[1]个粉丝
#
# 4. 每日一次轮询,30日前发帖的用户:[1-2]个粉丝
# 流失
# 每周3 执行一次轮询,超过7天没有访问的用户:[1-2]个粉丝
#
# 每周3 执行一次轮询,超过30天没有访问的用户:[1-2]个粉丝
# 发帖
# 5. 每日一次轮询,昨日有帖子被选为4、5星的用户:[1-5]个粉丝
\ No newline at end of file
import requests
import time
import datetime
import pymysql
import random
cookies = {
"sessionid": '6',
}
s = requests.session()
s.keep_alive = False
requests.adapters.DEFAULT_RETRIES = 5
auto_follow_url = "http://earth.igengmei.com/api/v1/follow"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
def index_first():
r1=requests.get(login_url)
return r1.cookies.get_dict()
def login(cookies,user,pwd):
post_dict={
'account_type':user,
'pwd':pwd
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
print(response.text, 'url')
def follow(cookies_get, id):
post_dict = {
'type': 1,
'id': id
}
response = requests.post(url=auto_follow_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
def time_conv():
now = datetime.datetime.now()
yes_time_str = now.strftime('%Y-%m-%d')
print(now)
return yes_time_str
def get_data(numtime,id):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
print("---------")
cursor.execute("SELECT user_id,follow_id FROM user_follow WHERE update_time LIKE '%%%%%s%%%%' and user_id in '%%%%s%%%%' " % (numtime,id))
data = cursor.fetchall()
print("Database version : %s " % data)
db.close()
return data
if __name__ == "__main__":
numtime = time_conv()
data = get_data(numtime,id)
dict = {}
for i in data.values:
if i[0] not in dict:
dict.setdefault(i[0], [])
dict[i[0]].append(i[1])
else:
dict[i[0]].append(i[1])
for key,value in dict.items():
#user_id=majia[key]
# cookies = index_first()
# login(cookies,user=user_id,pwd='')
for id in value:
follow(cookies, id)
# 关注 (特殊)如果马甲被关注,即刻 反向 关注用户 5min后 等同真实关注 等同真实关注
...@@ -56,30 +56,19 @@ def time_conv(numtime): ...@@ -56,30 +56,19 @@ def time_conv(numtime):
print(now) print(now)
return yes_time_str return yes_time_str
def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
cursor = db.cursor()
print("---------")
cursor.execute("SELECT id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" %numtime)
data = cursor.fetchall()
user_id = list(data)
print("Database version : %s " % user_id)
db.close()
return user_id def get_data(numtime):
def get_star_data(numtime): db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor() cursor = db.cursor()
print("---------") print("---------")
cursor.execute( cursor.execute("SELECT user_id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" %numtime)
"SELECT id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall() data = cursor.fetchall()
user_id = list(data) user_id = list(data)
print("Database version : %s " % user_id) print("Database version : %s " % user_id)
...@@ -89,14 +78,15 @@ def get_star_data(numtime): ...@@ -89,14 +78,15 @@ def get_star_data(numtime):
return user_id return user_id
def get_all(numtime): def get_new_user_id(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306) db="alpha", port=3306)
cursor = db.cursor() cursor = db.cursor()
print("---------") print("---------")
## 每日一次轮询,给每个昨日新注册用户pick:[0-1]个粉丝pick了你
cursor.execute( cursor.execute(
"select user_id from account_user WHERE create_time LIKE '%%%%%s%%%%'" % numtime) "select user_id from account_user WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
...@@ -111,53 +101,61 @@ def get_all(numtime): ...@@ -111,53 +101,61 @@ def get_all(numtime):
return user_id return user_id
if __name__ == "__main__": if __name__ == "__main__":
sleep_time=[] time_list = [1, 3 ,4]
for i in range(1,7): for i in range(2):
sleep_time.append(random.randint(1800,3500)) numtime = time_conv(time_list[i])
for i in sleep_time: user_id = get_data(numtime)
time.sleep(i) for j in user_id:
time_list=[1,3,5,7] id = int(j[0])
for i in time_list: num_cishu = random.randint(1,2)
numtime=time_conv(i) for i in range(num_cishu):
user_id=get_data(numtime) time.sleep(random.randint(300, 500))
for j in user_id: num_userid = random.randint(300)
#user_id=majia[num]
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
pick(cookies, id)
time.sleep(random.randint(3000, 5000))
new_user_id =get_new_user_id(1)
tie_user_id = get_data(1)
for i in new_user_id:
for j in tie_user_id:
if i == j :
id=int(j[0]) # time.sleep(random.randint(300, 500))
cookies=index_first() num_userid = random.randint(300)
login(cookies,user=cookies,pwd='') # user_id=majia[num]
comment="太好看了!" # cookies = index_first()
id = 1 # login(cookies,user=cookies,pwd='')
pick(cookies,id,comment) pick(cookies, id)
# 启动
# 每日一次轮询,昨日启动 即触发pick策略:[0-1]个粉丝pick了你
# 发帖
# 1. 每日一次轮询,昨日发帖的用户:[1-2]个粉丝pick了你
#
# 2. 每日一次轮询,3日前发帖的用户:[1-2]个粉丝pick了你
#
# 3. 每日一次轮询,昨日有帖子被选为4、5星的用户:[1-5]个粉丝pick了你
# 流失
# 每周3 执行一次轮询,超过7天没有访问的用户:[1-2]个粉丝pick了你
#
# 每周3 执行一次轮询,超过30天没有访问的用户:[1-2]个粉丝pick了你
...@@ -3,6 +3,7 @@ import time ...@@ -3,6 +3,7 @@ import time
import datetime import datetime
import pymysql import pymysql
import random import random
import pandas as pd
cookies = { cookies = {
"sessionid": '6', "sessionid": '6',
...@@ -15,15 +16,17 @@ s.keep_alive = False ...@@ -15,15 +16,17 @@ s.keep_alive = False
requests.adapters.DEFAULT_RETRIES = 5 requests.adapters.DEFAULT_RETRIES = 5
auto_click_url = "http://earth.igengmei.com/api/v1/user/urge" auto_urge_url = "http://earth.igengmei.com/api/v1/user/urge"
login_url = "http://earth.igengmei.com/api/account/login_pwd" login_url = "http://earth.igengmei.com/api/account/login_pwd"
def index_first(): def index_first():
r1=requests.get(login_url) r1=requests.get(login_url)
return r1.cookies.get_dict() return r1.cookies.get_dict()
def login(cookies,user,pwd): def login(cookies,user,pwd):
post_dict={ post_dict={
'account_type':user, 'account_type':user,
...@@ -37,25 +40,17 @@ def login(cookies,user,pwd): ...@@ -37,25 +40,17 @@ def login(cookies,user,pwd):
print(response.text, 'url') print(response.text, 'url')
def Urge(cookies_get, id): def Urge(cookies_get, id,comment):
post_dict = { post_dict = {
'id': id 'id': id,
'comment':comment
} }
response = requests.post(url=auto_click_url, response = requests.post(url=auto_urge_url,
cookies=cookies_get, cookies=cookies_get,
data=post_dict) data=post_dict)
print(response.text, 'url') print(response.text, 'url')
content = response.text
# list= []
# for i in content[0].strip('{}').split(','):
# for j in i.split(':'):
# list.append(j)
# if list[1]==' 1':
# print('click error ')
def time_conv(numtime): def time_conv(numtime):
now = datetime.datetime.now() now = datetime.datetime.now()
...@@ -66,53 +61,52 @@ def time_conv(numtime): ...@@ -66,53 +61,52 @@ def time_conv(numtime):
def get_data(numtime): def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306) db="alpha", port=3306)
cursor = db.cursor() cursor = db.cursor()
print("---------") print("---------")
cursor.execute("SELECT id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime) cursor.execute("SELECT user_id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall() data = cursor.fetchall()
cursor.execute("SELECT id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime) user_id = list(data)
data_star = cursor.fetchall()
data_id = list(data)
data_star =list(data)
user_id=[]
for i in data_id:
user_id.append(i)
for i in data_star:
user_id.append(i)
print("Database version : %s " % user_id) print("Database version : %s " % user_id)
db.close() db.close()
return user_id return user_id
if __name__ == "__main__": if __name__ == "__main__":
sleep_time=[] time_list = [1, 3,7]
for i in range(len(time_list)):
time_list=[1,3,7] numtime = time_conv(time_list[i])
for i in range(0,3): user_id = get_data(numtime)
sleep_time.append(random.randint(3400,7200)) for j in user_id:
time.sleep(sleep_time[i]) id = int(j[0])
numtime=time_conv(time_list[i]) time.sleep(random.randint(200,500))
user_id = get_data(numtime) num_cishu = random.randint(0, 2)
for j in user_id: if num_cishu == 0 and time_list[i]==1:
id= int(j[0]) pass
elif num_cishu == 1 :
num_majia = random.randint(1, 300)
#user_id=majia[num]
# cookies = index_first() # cookies = index_first()
...@@ -120,6 +114,23 @@ if __name__ == "__main__": ...@@ -120,6 +114,23 @@ if __name__ == "__main__":
Urge(cookies, id) Urge(cookies, id)
else:
for i in range(num_cishu):
num_majia = random.randint(0, 300)
#user_id=majia[num]
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
Urge(cookies, id)
time.sleep(random.randint(2000, 3000))
# 发帖 # 发帖
# 1. 每日一次轮询,昨日发帖的用户:自动取[0-2]马甲催更 # 1. 每日一次轮询,昨日发帖的用户:自动取[0-2]马甲催更
......
This diff is collapsed.
comment scene
坐等更新 催更
终于想起密码了么 催更
终于更新了 催更
终于等到你更新了 催更
终于等到你,还好我没放弃 催更
只想看到你更新 催更
再不更新真的取关了 催更
再不更新我就要去追杀你了 催更
再不更新我就不爱你了 催更
再不出现我就要报警了 催更
想你嘤嘤嘤 催更
我等更要等到花都谢了 催更
我的天,居然更新了 催更
我不管我要更新 催更
什么时候更新啊…… 催更
日常催更 催更
求日更 催更
庆祝失踪人口回归 催更
你一定是听到我的催更了 催更
你一定是感受到我的思念了 催更
你还记得更新呐,我谢谢您内~ 催更
每天都更新好么 催更
快更新……新……新……新…… 催更
更新更新更新 催更
等了好久终于更新了 催更
持续等更新 催更
不更新我就天天催 催更
不更新我会想死你的 催更
\ No newline at end of file
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