Commit 322b46ac authored by lixiaofang's avatar lixiaofang

hh

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