Commit fe136b49 authored by 李小芳's avatar 李小芳

add

parent ead3d0b3
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/cybertron.iml" filepath="$PROJECT_DIR$/.idea/cybertron.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectFrameBounds">
<option name="x" value="226" />
<option name="y" value="309" />
<option name="width" value="932" />
<option name="height" value="734" />
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
</project>
\ No newline at end of file
......@@ -2,94 +2,205 @@ import requests
import time
import datetime
import pymysql
import random
cookies = {
"sessionid": '1',
}
#login click
s = requests.session()
s.keep_alive = False
requests.adapters.DEFAULT_RETRIES = 5
auto_click_url = "http://earth.igengmei.com/api/v1/like"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
def index_first():#抽取需要get的cookies
def index_first():
r1=requests.get(login_url)
return r1.cookies.get_dict()
def login(cookies,user,pwd):
post_dict={#登录时要提交的数据
post_dict={
'account_type':user,
'pwd':pwd
}
response=requests.post(
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
print(response.text,'url')
print(response.text, 'url')
def dz(cookies_get,id):
post_dict={
'type':0,
'id':id
def dz(cookies_get, id):
post_dict = {
'type': 1,
'id': id
}
response=requests.post(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
response = requests.post(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
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()
three_days_later = now -datetime.timedelta(days=numtime)
print(three_days_later)
print(now())
return numtime
yes_time = now - datetime.timedelta(days=numtime)
yes_time_str = yes_time.strftime('%Y-%m-%d')
print(now)
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
# 打开数据库连接
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
def get_star_data(numtime):
# 使用cursor()方法获取操作游标
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
# 使用execute方法执行SQL语句
cursor.execute("select id from topic where is_online=0 and create_time ={}".format(numtime))
print("---------")
# 使用 fetchone() 方法获取一条数据
data = cursor.fetchall()
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
time_list=[1,3,5,7,15,21,28,35]
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__":
sleep_time,time_list,user_list=one_zero()
for i in range(0,9):
time.sleep(sleep_time[i])
numtime = time_conv(time_list[i])
user_id = get_data(numtime)
for j in user_id:
id = int(j[0])
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
dz(cookies, id)
sleep_time, time_list, user_list = one_two()
for i in range(1, 3):
time.sleep(sleep_time[i])
numtime = time_conv(time_list[i])
user_id = get_star_data(numtime)
for j in user_id:
id = int(j[0])
for i in time_list:
# cookies = index_first()
numtime=time_conv(i)
# login(cookies,user=cookies,pwd='')
user_id=get_data(numtime)
dz(cookies, id)
for i in user_id:
cookies=index_first()
# 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]个马甲点赞
login(cookies,user=cookies,pwd='')
dz(cookies,i)
# 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
cookies = {
"sessionid": '1',
}
auto_click_url = "http://earth.igengmei.com/api/v1/reply/create"
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 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(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_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
if __name__ == "__main__":
sleep_time=[]
for i in range(0,6):
sleep_time.append(random.randint(1800,3500))
for i in sleep_time:
time.sleep(i)
time_list=[1,3,5,7]
for i in time_list:
numtime=time_conv(i)
user_id=get_data(numtime)
for j in user_id:
id=int(j[0])
cookies=index_first()
login(cookies,user=cookies,pwd='')
comment="太好看了!"
id = 1
reply(cookies,id,comment)
# 1. 用户发帖后,[瞬时],什么也不做,担心用户要互动就穿帮
#
# 2. 每日一次轮询,找每个昨日新增帖:随机从马甲库里取一个马甲,搭配随机评论库一条评论
#
# 3. 每日一次轮询,3日前新增帖子:随机从马甲库里取一个马甲,搭配随机评论库一条评论
#
# 4. 每日一次轮询,5日前新增帖子:随机从马甲库里取一个马甲,搭配随机评论库一条评论
#
# 5. 每日一次轮询,7日前新增帖子:随机从马甲库里取一个马甲,搭配随机评论库一条评论
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')
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):
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_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()
# 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_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):
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 FROM reply WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_comment = cursor.fetchall()
cursor.execute(
"SELECT replied_id FROM reply WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_reply = cursor.fetchall()
cursor.execute(
"SELECT user_id FROM group_follow WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_group_follow = cursor.fetchall()
cursor.execute(
"select user_id from account_user WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
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)
data1_id=list(data_reply)
data2_id=list(data_group_follow)
data3_id=list(data_new_user)
data4_id=list(data_majia_follow)
majia_list=[]
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:
user_id.append(i)
for i in data1_id:
user_id.append(i)
for i in data2_id:
user_id.append(i)
for i in data3_id:
user_id.append(i)
print("Database version : %s " % user_id)
db.close()
return user_id
if __name__ == "__main__":
sleep_time=[]
flag = 0
for i in range(0,11):
sleep_time.append(random.randint(1800,3500))
for i in sleep_time:
time.sleep(i)
if flag == 0:
numtime=time_conv(1)
user_id = get_star_data(numtime)
# 1-5 fensi
for j in user_id:
id= int(j[0])
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
follow(cookies, id)
time_list = [1, 2, 7, 30]
numtime = time_conv(time_list[flag])
user_id = get_data(numtime)
for j in user_id:
id = int(j[0])
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
follow(cookies, id)
flag += 1
user_id=get_commnet_id(1)
# 注册
# 1. 每日一次轮询,给每个昨日新注册用户加粉:[0-1]个粉丝
# 启动***********
# 1. 每日一次轮询,昨日启动 即触发加粉策略:[0-1]个粉丝
# 评论
# 1. 昨日有收到评论的用户:[0-1]个粉丝
#
# 2. 昨日有发出评论的用户:[0-1]个粉丝
# 加组
# 1. 昨日加组的用户:[0-1]个粉丝
# 关注
# 如果马甲被关注,即刻 反向 关注用户 5min后
# 发帖
# 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": '1',
}
auto_click_url = "http://earth.igengmei.com/api/v1/pick/do_pick"
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 pick(cookies_get,id,content):
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_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_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_all(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
print("---------")
## 每日一次轮询,给每个昨日新注册用户pick:[0-1]个粉丝pick了你
cursor.execute(
"select user_id from account_user WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_new_user = cursor.fetchall()
data3_id = list(data_new_user)
print("Database version : %s " % user_id)
db.close()
return user_id
if __name__ == "__main__":
sleep_time=[]
for i in range(1,7):
sleep_time.append(random.randint(1800,3500))
for i in sleep_time:
time.sleep(i)
time_list=[1,3,5,7]
for i in time_list:
numtime=time_conv(i)
user_id=get_data(numtime)
for j in user_id:
id=int(j[0])
cookies=index_first()
login(cookies,user=cookies,pwd='')
comment="太好看了!"
id = 1
pick(cookies,id,comment)
# 启动
# 每日一次轮询,昨日启动 即触发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了你
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_click_url = "http://earth.igengmei.com/api/v1/user/urge"
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 Urge(cookies_get, id):
post_dict = {
'id': id
}
response = requests.post(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
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):
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_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()
cursor.execute("SELECT id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
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)
db.close()
return user_id
if __name__ == "__main__":
sleep_time=[]
time_list=[1,3,7]
for i in range(0,3):
sleep_time.append(random.randint(3400,7200))
time.sleep(sleep_time[i])
numtime=time_conv(time_list[i])
user_id = get_data(numtime)
for j in user_id:
id= int(j[0])
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
Urge(cookies, id)
# 发帖
# 1. 每日一次轮询,昨日发帖的用户:自动取[0-2]马甲催更
#
# 2. 每日一次轮询,3日前发帖的用户:[1-2]马甲催更
#
# 3. 每日一次轮询,7日前发帖的用户:[1-2]马甲催更
#
# 3. 每日一次轮询,昨日有帖子被选为4、5星的用户:[1-5]马甲催更
# 流失
# 每周3 执行一次轮询,超过7天没有访问的用户:[1-2]马甲催更
\ 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