Commit 322b46ac authored by lixiaofang's avatar lixiaofang

hh

parent 5ca64ea2
This diff is collapsed.
...@@ -5,12 +5,6 @@ import pymysql ...@@ -5,12 +5,6 @@ import pymysql
import random import random
import pandas as pd 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/like"
auto_click_url = "http://earth.igengmei.com/api/v1/reply/create" auto_click_url = "http://earth.igengmei.com/api/v1/reply/create"
auto_follow_url = "http://earth.igengmei.com/api/v1/follow" auto_follow_url = "http://earth.igengmei.com/api/v1/follow"
...@@ -23,20 +17,38 @@ def index_first(): ...@@ -23,20 +17,38 @@ def index_first():
return r1.cookies.get_dict() return r1.cookies.get_dict()
def login():
num_majia = random.randint(1, 300)
cookies = index_first()
# user_id=majia[num]
def login(cookies,user,pwd): user = 's_PzFznI@shadow.com'
pwd = '123456'
post_dict={ post_dict={
'account_type':user, 'account_type':2,
'pwd':pwd 'pwd':pwd,
'email':user
} }
response=requests.post( response = requests.post(
url=login_url, url=login_url,
data=post_dict, data=post_dict,
cookies=cookies cookies=cookies
) )
print(response.text,'url')
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
print(response.text, 'url')
return {'sessionid': cook}
def follow(cookies_get, id): def follow(cookies_get, id):
post_dict = { post_dict = {
...@@ -49,7 +61,6 @@ def follow(cookies_get, id): ...@@ -49,7 +61,6 @@ def follow(cookies_get, id):
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,
...@@ -61,7 +72,6 @@ def dz(cookies_get, id): ...@@ -61,7 +72,6 @@ def dz(cookies_get, id):
print(response.text, 'url') print(response.text, 'url')
def reply(cookies_get,id,content): def reply(cookies_get,id,content):
post_dict={ post_dict={
'topic_id':id, 'topic_id':id,
...@@ -73,14 +83,12 @@ def reply(cookies_get,id,content): ...@@ -73,14 +83,12 @@ def reply(cookies_get,id,content):
print(response.text, 'url') print(response.text, 'url')
def time_conv(): def time_conv():
now = datetime.datetime.now() now = datetime.datetime.now()
yes_time_str=now.strftime('%Y-%m-%d') yes_time_str=now.strftime('%Y-%m-%d')
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',
...@@ -96,7 +104,6 @@ def get_data(numtime): ...@@ -96,7 +104,6 @@ def get_data(numtime):
db.close() db.close()
return user_id return user_id
def get_comment(): def get_comment():
data = pd.read_csv("guanshui", sep='\n') data = pd.read_csv("guanshui", sep='\n')
...@@ -110,7 +117,6 @@ def get_comment(): ...@@ -110,7 +117,6 @@ def get_comment():
return comment return comment
if __name__ == "__main__": if __name__ == "__main__":
numtime=time_conv() numtime=time_conv()
...@@ -125,22 +131,20 @@ if __name__ == "__main__": ...@@ -125,22 +131,20 @@ if __name__ == "__main__":
if num == 0: if num == 0:
# user_id=majia[num] cookies=login()
cookies = index_first()
login(cookies,user=cookies,pwd='')
comment = get_comment() comment = get_comment()
reply(cookies, id, comment) reply(cookies, id, comment)
if num == 1: if num == 1:
# user_id=majia[num] cookies = login()
cookies = index_first()
login(cookies,user=cookies,pwd='')
dz(cookies, id) dz(cookies, id)
comment = get_comment() comment = get_comment()
reply(cookies, id, comment) reply(cookies, id, comment)
......
...@@ -4,11 +4,6 @@ import datetime ...@@ -4,11 +4,6 @@ import datetime
import pymysql import pymysql
import random import random
# cookies = {
# "sessionid": '1',
# }
s = requests.session() s = requests.session()
s.keep_alive = False s.keep_alive = False
...@@ -19,14 +14,23 @@ auto_click_url = "http://earth.igengmei.com/api/v1/like" ...@@ -19,14 +14,23 @@ auto_click_url = "http://earth.igengmei.com/api/v1/like"
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():
num_majia = random.randint(1, 300)
# user_id=majia[num_majia]
user = 's_PzFznI@shadow.com'
pwd = '123456'
cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
...@@ -38,8 +42,17 @@ def login(cookies,user,pwd): ...@@ -38,8 +42,17 @@ def login(cookies,user,pwd):
data=post_dict, data=post_dict,
cookies=cookies cookies=cookies
) )
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
print(response.text, 'url') print(response.text, 'url')
return {'sessionid': cook}
def dz(cookies_get, id): def dz(cookies_get, id):
post_dict = { post_dict = {
'type': 1, 'type': 1,
...@@ -51,6 +64,11 @@ def dz(cookies_get, id): ...@@ -51,6 +64,11 @@ def dz(cookies_get, id):
print(response.text, 'url') print(response.text, 'url')
text=response.text
if text[0]['error'] == 1 and text[0]['message']=='\\u5e16\\u5b50\\u5df2\\u4e0b\\u7ebf':
print("该产品已下线")
def time_conv(numtime): def time_conv(numtime):
now = datetime.datetime.now() now = datetime.datetime.now()
...@@ -94,17 +112,7 @@ if __name__ == "__main__": ...@@ -94,17 +112,7 @@ if __name__ == "__main__":
if num_cishu == 1: if num_cishu == 1:
num_majia = random.randint(1, 300) cookies=login()
#user_id=majia[num_majia]
user = 's_PzFznI@shadow.com'
pwd = '123456'
cookies = index_first()
login(cookies,user=user,pwd=pwd)
dz(cookies, id) dz(cookies, id)
......
...@@ -26,24 +26,45 @@ auto_urge_url = "http://earth.igengmei.com/api/v1/user/urge" ...@@ -26,24 +26,45 @@ auto_urge_url = "http://earth.igengmei.com/api/v1/user/urge"
auto_click_url = "http://earth.igengmei.com/api/v1/pick/do_pick" auto_click_url = "http://earth.igengmei.com/api/v1/pick/do_pick"
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():
# time.sleep(random.randint(300, 700))
num_majia = random.randint(1, 300)
cookies = index_first()
# user_id=majia[num]
user = 's_PzFznI@shadow.com'
pwd = '123456'
post_dict={ post_dict={
'account_type':user, 'account_type':2,
'pwd':pwd 'pwd':pwd,
'email':user
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
data=post_dict, data=post_dict,
cookies=cookies cookies=cookies
) )
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
print(response.text, 'url') print(response.text, 'url')
return {'sessionid': cook}
def dz(cookies_get, id): def dz(cookies_get, id):
post_dict = { post_dict = {
'type': 1, 'type': 1,
...@@ -134,6 +155,7 @@ def get_star_tieid(numtime): ...@@ -134,6 +155,7 @@ def get_star_tieid(numtime):
return user_id return user_id
if __name__ == "__main__": if __name__ == "__main__":
time_list = [1, 3, 7,10] time_list = [1, 3, 7,10]
...@@ -152,13 +174,7 @@ if __name__ == "__main__": ...@@ -152,13 +174,7 @@ if __name__ == "__main__":
for j in range(num_cishu): for j in range(num_cishu):
time.sleep(random.randint(300,400)) cookies=login()
num_tieid = random.randint(1,300)
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
dz(cookies, id) dz(cookies, id)
...@@ -172,13 +188,7 @@ if __name__ == "__main__": ...@@ -172,13 +188,7 @@ if __name__ == "__main__":
for j in range(num_cishu): for j in range(num_cishu):
time.sleep(random.randint(300, 400)) cookies = login()
num_tieid = random.randint(1, 300)
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
dz(cookies, id) dz(cookies, id)
...@@ -192,13 +202,7 @@ if __name__ == "__main__": ...@@ -192,13 +202,7 @@ if __name__ == "__main__":
for j in range(num_cishu): for j in range(num_cishu):
time.sleep(random.randint(300, 400)) cookies = login()
num_userid = random.randint(1, 300)
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
follow(cookies, id) follow(cookies, id)
......
...@@ -17,8 +17,19 @@ def index_first(): ...@@ -17,8 +17,19 @@ def index_first():
return r1.cookies.get_dict() return r1.cookies.get_dict()
def login():
def login(cookies,user,pwd): # time.sleep(random.randint(300, 700))
num_majia = random.randint(1, 300)
cookies = index_first()
# user_id=majia[num]
user = 's_PzFznI@shadow.com'
pwd = '123456'
post_dict={ post_dict={
'account_type':2, 'account_type':2,
...@@ -39,8 +50,7 @@ def login(cookies,user,pwd): ...@@ -39,8 +50,7 @@ def login(cookies,user,pwd):
print(response.text, 'url') print(response.text, 'url')
return cook return {'sessionid': cook}
def reply(cookies_get,id,content): def reply(cookies_get,id,content):
post_dict={ post_dict={
...@@ -51,9 +61,14 @@ def reply(cookies_get,id,content): ...@@ -51,9 +61,14 @@ def reply(cookies_get,id,content):
cookies=cookies_get, cookies=cookies_get,
data=post_dict) data=post_dict)
print(response.text,'url') text=response.text
if text[0]['error'] == 1 and text[0]['message']=='\\u5e16\\u5b50\\u5df2\\u4e0b\\u7ebf':
print("该产品已下线")
print(response.text,'url')
def time_conv(numtime): def time_conv(numtime):
now = datetime.datetime.now() now = datetime.datetime.now()
...@@ -61,7 +76,6 @@ def time_conv(numtime): ...@@ -61,7 +76,6 @@ def time_conv(numtime):
yes_time_str=yes_time.strftime('%Y-%m-%d') yes_time_str=yes_time.strftime('%Y-%m-%d')
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="alpha", port=3306) db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
...@@ -70,11 +84,12 @@ def get_data(numtime): ...@@ -70,11 +84,12 @@ def get_data(numtime):
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
def get_comment(): def get_comment():
...@@ -89,7 +104,6 @@ def get_comment(): ...@@ -89,7 +104,6 @@ def get_comment():
return comment return comment
if __name__ == "__main__": if __name__ == "__main__":
time_list = [1, 3, 5, 7] time_list = [1, 3, 5, 7]
...@@ -106,15 +120,7 @@ if __name__ == "__main__": ...@@ -106,15 +120,7 @@ if __name__ == "__main__":
id = int(j[0]) id = int(j[0])
time.sleep(random.randint(300,700)) cookies=login()
num_majia = random.randint(1, 300)
#user_id=majia[num]
cookies = index_first()
cookies=login(cookies,user=cookies,pwd='')
comment = get_comment() comment = get_comment()
......
...@@ -24,18 +24,40 @@ def index_first(): ...@@ -24,18 +24,40 @@ 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():
time.sleep(random.randint(300, 500))
num_majia = random.randint(1, 300)
# user_id=majia[num_majia]
user = 's_PzFznI@shadow.com'
pwd = '123456'
cookies = index_first()
post_dict={ post_dict={
'account_type':user, 'account_type':2,
'pwd':pwd 'pwd':pwd,
'email':user
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
data=post_dict, data=post_dict,
cookies=cookies cookies=cookies
) )
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
print(response.text, 'url') print(response.text, 'url')
return {'sessionid': cook}
def follow(cookies_get, id): def follow(cookies_get, id):
post_dict = { post_dict = {
...@@ -48,7 +70,6 @@ def follow(cookies_get, id): ...@@ -48,7 +70,6 @@ def follow(cookies_get, id):
print(response.text, 'url') print(response.text, 'url')
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)
...@@ -56,7 +77,6 @@ def time_conv(numtime): ...@@ -56,7 +77,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)
...@@ -144,15 +164,7 @@ if __name__ == "__main__": ...@@ -144,15 +164,7 @@ if __name__ == "__main__":
for i in range(num_cishu): for i in range(num_cishu):
time.sleep(random.randint(300, 500)) cookies=login()
num_majia = random.randint(300)
# user_id=majia[num]
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
follow(cookies, id) follow(cookies, id)
...@@ -172,15 +184,7 @@ if __name__ == "__main__": ...@@ -172,15 +184,7 @@ if __name__ == "__main__":
for i in range(num_cishu): for i in range(num_cishu):
time.sleep(random.randint(300, 500)) cookies = login()
num_majia = random.randint(300)
#user_id=majia[num]
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
follow(cookies, id) follow(cookies, id)
......
...@@ -22,18 +22,39 @@ def index_first(): ...@@ -22,18 +22,39 @@ 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():
num_majia = random.randint(1, 300)
# user_id=majia[num_majia]
user = 's_PzFznI@shadow.com'
pwd = '123456'
cookies = index_first()
post_dict={ post_dict={
'account_type':user, 'account_type':2,
'pwd':pwd 'pwd':pwd,
'email':user
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
data=post_dict, data=post_dict,
cookies=cookies cookies=cookies
) )
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
print(response.text, 'url') print(response.text, 'url')
return {'sessionid': cook}
def follow(cookies_get, id): def follow(cookies_get, id):
post_dict = { post_dict = {
'type': 1, 'type': 1,
...@@ -87,11 +108,7 @@ if __name__ == "__main__": ...@@ -87,11 +108,7 @@ if __name__ == "__main__":
for key,value in dict.items(): for key,value in dict.items():
#user_id=majia[key] cookies=login()
# cookies = index_first()
# login(cookies,user=user_id,pwd='')
for id in value: for id in value:
......
...@@ -4,36 +4,48 @@ import datetime ...@@ -4,36 +4,48 @@ import datetime
import pymysql import pymysql
import random import random
cookies = {
"sessionid": '1',
}
auto_click_url = "http://earth.igengmei.com/api/v1/pick/do_pick" auto_click_url = "http://earth.igengmei.com/api/v1/pick/do_pick"
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():
num_majia = random.randint(1, 300)
# user_id=majia[num_majia]
def login(cookies,user,pwd): user = 's_PzFznI@shadow.com'
pwd = '123456'
cookies = index_first()
post_dict={ post_dict={
'account_type':user, 'account_type':2,
'pwd':pwd 'pwd':pwd,
'email':user
} }
response=requests.post( response = requests.post(
url=login_url, url=login_url,
data=post_dict, data=post_dict,
cookies=cookies cookies=cookies
) )
print(response.text,'url')
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
print(response.text, 'url')
return {'sessionid': cook}
def pick(cookies_get,id,content): def pick(cookies_get,id,content):
post_dict={ post_dict={
...@@ -119,15 +131,7 @@ if __name__ == "__main__": ...@@ -119,15 +131,7 @@ if __name__ == "__main__":
for i in range(num_cishu): for i in range(num_cishu):
time.sleep(random.randint(300, 500)) cookies=login()
num_userid = random.randint(300)
#user_id=majia[num]
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
pick(cookies, id) pick(cookies, id)
...@@ -144,15 +148,7 @@ if __name__ == "__main__": ...@@ -144,15 +148,7 @@ if __name__ == "__main__":
if i == j : if i == j :
# time.sleep(random.randint(300, 500)) cookies=login(cookies,user=cookies,pwd='')
num_userid = random.randint(300)
# user_id=majia[num]
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
pick(cookies, id) pick(cookies, id)
......
...@@ -27,18 +27,38 @@ def index_first(): ...@@ -27,18 +27,38 @@ def index_first():
return r1.cookies.get_dict() return r1.cookies.get_dict()
def login(cookies,user,pwd): def login():
num_majia = random.randint(1, 300)
# user_id=majia[num_majia]
user = 's_PzFznI@shadow.com'
pwd = '123456'
cookies = index_first()
post_dict={ post_dict={
'account_type':user, 'account_type':2,
'pwd':pwd 'pwd':pwd,
'email':user
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
data=post_dict, data=post_dict,
cookies=cookies cookies=cookies
) )
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
print(response.text, 'url') print(response.text, 'url')
return {'sessionid': cook}
def Urge(cookies_get, id,comment): def Urge(cookies_get, id,comment):
post_dict = { post_dict = {
...@@ -51,7 +71,6 @@ def Urge(cookies_get, id,comment): ...@@ -51,7 +71,6 @@ def Urge(cookies_get, id,comment):
print(response.text, 'url') print(response.text, 'url')
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)
...@@ -59,7 +78,6 @@ def time_conv(numtime): ...@@ -59,7 +78,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',
...@@ -72,7 +90,6 @@ def get_data(numtime): ...@@ -72,7 +90,6 @@ def get_data(numtime):
user_id = list(data) user_id = list(data)
print("Database version : %s " % user_id) print("Database version : %s " % user_id)
db.close() db.close()
...@@ -104,13 +121,7 @@ if __name__ == "__main__": ...@@ -104,13 +121,7 @@ if __name__ == "__main__":
elif num_cishu == 1 : elif num_cishu == 1 :
num_majia = random.randint(1, 300) login()
#user_id=majia[num]
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
Urge(cookies, id) Urge(cookies, id)
...@@ -118,13 +129,7 @@ if __name__ == "__main__": ...@@ -118,13 +129,7 @@ if __name__ == "__main__":
for i in range(num_cishu): for i in range(num_cishu):
num_majia = random.randint(0, 300) cookies=login()
#user_id=majia[num]
# cookies = index_first()
# login(cookies,user=cookies,pwd='')
Urge(cookies, id) Urge(cookies, id)
......
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