Commit 70e95e89 authored by lixiaofang's avatar lixiaofang

majia new

parent 81c37f5c
This diff is collapsed.
...@@ -25,11 +25,9 @@ def get_majia(): ...@@ -25,11 +25,9 @@ def get_majia():
for i in data: for i in data:
list.append(i.strip('\n').strip(',')) list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500)) # time.sleep(random.randint(0, 500))
maj = random.randint(1,len(list))
maj = random.randint(1, 300)
user_id=list[maj] user_id=list[maj]
...@@ -39,20 +37,14 @@ def login(): ...@@ -39,20 +37,14 @@ def login():
# time.sleep(random.randint(300, 500)) # time.sleep(random.randint(300, 500))
num_majia = random.randint(1, 300) user_id=get_majia()
# user_id=majia[num_majia]
user = 's_PzFznI@shadow.com'
pwd = '123456'
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':user_id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -201,26 +193,26 @@ if __name__ == "__main__": ...@@ -201,26 +193,26 @@ if __name__ == "__main__":
#get majia zhanghao #get majia zhanghao
data = get_follw_majia(numtime, id) # data = get_follw_majia(numtime, id)
#
dict = {} # dict = {}
#
for i in data: # for i in data:
#
if i[0] not in dict: # if i[0] not in dict:
dict.setdefault(i[0], []) # dict.setdefault(i[0], [])
dict[i[0]].append(i[1]) # dict[i[0]].append(i[1])
#
else: # else:
dict[i[0]].append(i[1]) # dict[i[0]].append(i[1])
#
for key, value in dict.items(): # for key, value in dict.items():
#
cookies = logins(key) # cookies = logins(key)
#
for id in value: # for id in value:
#
follow(cookies, id) # follow(cookies, id)
......
...@@ -28,11 +28,9 @@ def get_majia(): ...@@ -28,11 +28,9 @@ def get_majia():
for i in data: for i in data:
list.append(i.strip('\n').strip(',')) list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500)) # time.sleep(random.randint(0, 500))
maj = random.randint(1,len(list))
maj = random.randint(1, 300)
user_id=list[maj] user_id=list[maj]
...@@ -44,13 +42,7 @@ def login(): ...@@ -44,13 +42,7 @@ def login():
# time.sleep(random.randint(300, 500)) # time.sleep(random.randint(300, 500))
num_majia = random.randint(1, 300) user_id=get_majia()
user_id=get_majia[num_majia]
# user = 's_PzFznI@shadow.com'
#
# pwd = '123456'
cookies = index_first() cookies = index_first()
......
...@@ -14,24 +14,30 @@ def index_first(): ...@@ -14,24 +14,30 @@ def index_first():
return r1.cookies.get_dict() return r1.cookies.get_dict()
def login(): def get_majia():
# time.sleep(random.randint(300, 500)) data = open("batch user gen")
num_majia = random.randint(1, 300) list=[]
for i in data:
list.append(i.strip('\n').strip(','))
# user_id=majia[num_majia] # time.sleep(random.randint(0, 500))
user = 's_PzFznI@shadow.com' maj = random.randint(1, len(list))
pwd = '123456' user_id=list[maj-1]
return list
def logins(id):
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -47,8 +53,6 @@ def login(): ...@@ -47,8 +53,6 @@ def login():
print(response.text, 'url') print(response.text, 'url')
print(cook)
return {'sessionid': cook} return {'sessionid': cook}
def click(cookies_get, id): def click(cookies_get, id):
...@@ -117,7 +121,7 @@ if __name__ == "__main__": ...@@ -117,7 +121,7 @@ if __name__ == "__main__":
cookies = index_first() cookies = index_first()
cook=login() cook=logins()
click(cook, rand_id) click(cook, rand_id)
...@@ -28,36 +28,22 @@ def get_majia(): ...@@ -28,36 +28,22 @@ def get_majia():
for i in data: for i in data:
list.append(i.strip('\n').strip(',')) list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500)) # time.sleep(random.randint(0, 500))
maj = random.randint(1, len(list))
maj = random.randint(1, 300) user_id=list[maj-1]
user_id=list[maj]
print(user_id)
return user_id
def login():
# time.sleep(random.randint(300, 500))
num_majia = random.randint(1, 300)
# user_id=majia[num_majia] return list
user = 's_PzFznI@shadow.com' def logins(id):
pwd = '123456'
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -73,8 +59,6 @@ def login(): ...@@ -73,8 +59,6 @@ def login():
print(response.text, 'url') print(response.text, 'url')
print(cook)
return {'sessionid': cook} return {'sessionid': cook}
def follow(cookies_get, id): def follow(cookies_get, id):
...@@ -123,7 +107,7 @@ if __name__ == "__main__": ...@@ -123,7 +107,7 @@ if __name__ == "__main__":
cookies = index_first() cookies = index_first()
cook=login() cook=logins()
follow(cook, id) follow(cook, id)
......
...@@ -17,22 +17,30 @@ def index_first(): ...@@ -17,22 +17,30 @@ def index_first():
return r1.cookies.get_dict() return r1.cookies.get_dict()
def login(): def get_majia():
num_majia = random.randint(1, 300) data = open("batch user gen")
# user_id=majia[num_majia] list=[]
for i in data:
list.append(i.strip('\n').strip(','))
user = 's_FF3qUO@shadow.com' # time.sleep(random.randint(0, 500))
pwd = '123456' maj = random.randint(1, len(list))
user_id=list[maj-1]
return list
def logins(id):
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -48,8 +56,6 @@ def login(): ...@@ -48,8 +56,6 @@ def login():
print(response.text, 'url') print(response.text, 'url')
print(cook)
return {'sessionid': cook} return {'sessionid': cook}
def reply(cookies_get,id,content): def reply(cookies_get,id,content):
...@@ -114,7 +120,7 @@ if __name__ == "__main__": ...@@ -114,7 +120,7 @@ if __name__ == "__main__":
for i in topic_id: for i in topic_id:
cook = login() cook = logins()
comment = get_comment() comment = get_comment()
......
...@@ -14,24 +14,30 @@ def index_first(): ...@@ -14,24 +14,30 @@ 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(): def get_majia():
# time.sleep(random.randint(300, 500)) data = open("batch user gen")
num_majia = random.randint(1, 300) list=[]
for i in data:
list.append(i.strip('\n').strip(','))
# user_id=majia[num_majia] # time.sleep(random.randint(0, 500))
user = 's_PzFznI@shadow.com' maj = random.randint(1, len(list))
pwd = '123456' user_id=list[maj-1]
return list
def logins(id):
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -137,7 +143,7 @@ if __name__ == "__main__": ...@@ -137,7 +143,7 @@ if __name__ == "__main__":
# time.sleep(random.randint(500, 1500)) # time.sleep(random.randint(500, 1500))
cookies=login() cookies=logins()
follow(cookies, id) follow(cookies, id)
...@@ -154,7 +160,7 @@ if __name__ == "__main__": ...@@ -154,7 +160,7 @@ if __name__ == "__main__":
# time.sleep(random.randint(500, 1500)) # time.sleep(random.randint(500, 1500))
cookies = login() cookies = logins()
pick(cookies, id) pick(cookies, id)
......
...@@ -12,24 +12,30 @@ def index_first(): ...@@ -12,24 +12,30 @@ 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(): def get_majia():
# time.sleep(random.randint(300, 500)) data = open("batch user gen")
num_majia = random.randint(1, 300) list=[]
for i in data:
list.append(i.strip('\n').strip(','))
# user_id=majia[num_majia] # time.sleep(random.randint(0, 500))
user = 's_PzFznI@shadow.com' maj = random.randint(1, len(list))
pwd = '123456' user_id=list[maj-1]
return list
def logins(id):
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -174,7 +180,7 @@ if __name__ == "__main__": ...@@ -174,7 +180,7 @@ if __name__ == "__main__":
for i in range(follow_num): for i in range(follow_num):
cookies = login() cookies = logins()
follow(cookies, id) follow(cookies, id)
......
...@@ -25,13 +25,11 @@ def get_majia(): ...@@ -25,13 +25,11 @@ def get_majia():
for i in data: for i in data:
list.append(i.strip('\n').strip(',')) list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500)) # time.sleep(random.randint(0, 500))
# maj = random.randint(1, len(list))
# maj = random.randint(1, len(list))
# user_id=list[maj-1]
# user_id=list[maj]
return list return list
...@@ -94,7 +92,6 @@ def get_follw_majia(numtime,id): ...@@ -94,7 +92,6 @@ def get_follw_majia(numtime,id):
return data return data
if __name__ == "__main__": if __name__ == "__main__":
numtime=time_conv() numtime=time_conv()
......
...@@ -32,36 +32,22 @@ def get_majia(): ...@@ -32,36 +32,22 @@ def get_majia():
for i in data: for i in data:
list.append(i.strip('\n').strip(',')) list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500)) # time.sleep(random.randint(0, 500))
maj = random.randint(1, len(list))
maj = random.randint(1, 300) user_id=list[maj-1]
user_id=list[maj]
print(user_id)
return user_id
def login():
# time.sleep(random.randint(300, 500))
num_majia = random.randint(1, 300)
# user_id=majia[num_majia] return list
user = 's_PzFznI@shadow.com' def logins(id):
pwd = '123456'
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -77,8 +63,6 @@ def login(): ...@@ -77,8 +63,6 @@ def login():
print(response.text, 'url') print(response.text, 'url')
print(cook)
return {'sessionid': cook} return {'sessionid': cook}
def follow(cookies_get, id): def follow(cookies_get, id):
...@@ -143,7 +127,7 @@ if __name__ == "__main__": ...@@ -143,7 +127,7 @@ if __name__ == "__main__":
cookies = index_first() cookies = index_first()
cook=login() cook=logins()
pick(cook, id) pick(cook, id)
......
...@@ -14,22 +14,30 @@ def index_first(): ...@@ -14,22 +14,30 @@ def index_first():
return r1.cookies.get_dict() return r1.cookies.get_dict()
def login(): def get_majia():
num_majia = random.randint(1, 300) data = open("batch user gen")
# user_id=majia[num_majia] list=[]
for i in data:
list.append(i.strip('\n').strip(','))
user = 's_PzFznI@shadow.com' # time.sleep(random.randint(0, 500))
pwd = '123456' maj = random.randint(1, len(list))
user_id=list[maj-1]
return list
def logins(id):
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -202,7 +210,7 @@ if __name__ == "__main__": ...@@ -202,7 +210,7 @@ if __name__ == "__main__":
for x in range(pick_num): for x in range(pick_num):
cookies = login() cookies = logins()
pick(cookies, i) pick(cookies, i)
......
...@@ -20,40 +20,31 @@ def index_first(): ...@@ -20,40 +20,31 @@ def index_first():
return r1.cookies.get_dict() return r1.cookies.get_dict()
def get_majia(): def get_majia():
data = open("batch user gen") data = open("batch user gen")
list = [] list=[]
for i in data: for i in data:
list.append(i.strip('\n').strip(',')) list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500)) # time.sleep(random.randint(0, 500))
maj = random.randint(1, 300) maj = random.randint(1, len(list))
user_id = list[maj]
print(user_id)
return user_id
def login():
# time.sleep(random.randint(300, 500))
num_majia = random.randint(1, 300)
# user_id=majia[num_majia] user_id=list[maj-1]
user = 's_PzFznI@shadow.com' return list
pwd = '123456' def logins(id):
cookies = index_first() cookies = index_first()
post_dict = { post_dict={
'account_type': 2, 'account_type':2,
'pwd': pwd, 'pwd':'123456',
'email': user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -61,7 +52,7 @@ def login(): ...@@ -61,7 +52,7 @@ def login():
cookies=cookies cookies=cookies
) )
headers = response.headers headers=response.headers
cook = headers['Set-Cookie'].split(";") cook = headers['Set-Cookie'].split(";")
...@@ -69,8 +60,6 @@ def login(): ...@@ -69,8 +60,6 @@ def login():
print(response.text, 'url') print(response.text, 'url')
print(cook)
return {'sessionid': cook} return {'sessionid': cook}
def Urge(cookies_get, id): def Urge(cookies_get, id):
...@@ -89,7 +78,6 @@ def time_conv(numtime): ...@@ -89,7 +78,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 = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306) db="alpha", port=3306)
...@@ -102,7 +90,6 @@ def get_data(numtime): ...@@ -102,7 +90,6 @@ def get_data(numtime):
db.close() db.close()
return user_id return user_id
if __name__ == "__main__": if __name__ == "__main__":
# time.sleep(random.randint(3000,4500)) # time.sleep(random.randint(3000,4500))
...@@ -118,9 +105,9 @@ if __name__ == "__main__": ...@@ -118,9 +105,9 @@ if __name__ == "__main__":
for i in range(urge_num): for i in range(urge_num):
cookies = index_first() cookies = index_first()
cook = login() cook = logins()
follow(cook, id) Urge(cook, id)
......
...@@ -30,26 +30,22 @@ def get_majia(): ...@@ -30,26 +30,22 @@ def get_majia():
for i in data: for i in data:
list.append(i.strip('\n').strip(',')) list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500)) # time.sleep(random.randint(0, 500))
maj = random.randint(1, len(list))
maj = random.randint(1, 300) user_id=list[maj-1]
user_id=list[maj]
return user_id
def login(): return list
user_id=get_majia() def logins(id):
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':'123456', 'pwd':'123456',
'email':user_id 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -65,8 +61,6 @@ def login(): ...@@ -65,8 +61,6 @@ def login():
print(response.text, 'url') print(response.text, 'url')
print(cook)
return {'sessionid': cook} return {'sessionid': cook}
def click(cookies_get, id): def click(cookies_get, id):
...@@ -165,7 +159,7 @@ if __name__ == "__main__": ...@@ -165,7 +159,7 @@ if __name__ == "__main__":
for i in range(urge_num): for i in range(urge_num):
cookies = login() cookies = logins()
follow(cookies,id) follow(cookies,id)
......
...@@ -14,22 +14,30 @@ def index_first(): ...@@ -14,22 +14,30 @@ 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(): def get_majia():
num_majia = random.randint(1, 300) data = open("batch user gen")
# user_id=majia[num_majia] list=[]
for i in data:
list.append(i.strip('\n').strip(','))
user = 's_PzFznI@shadow.com' # time.sleep(random.randint(0, 500))
pwd = '123456' maj = random.randint(1, len(list))
user_id=list[maj-1]
return list
def logins(id):
cookies = index_first() cookies = index_first()
post_dict={ post_dict={
'account_type':2, 'account_type':2,
'pwd':pwd, 'pwd':'123456',
'email':user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -121,7 +129,7 @@ if __name__ == "__main__": ...@@ -121,7 +129,7 @@ if __name__ == "__main__":
for i in range(urge_num): for i in range(urge_num):
cookies=login() cookies=logins()
Urge(cookies, id) Urge(cookies, id)
...@@ -142,7 +150,7 @@ if __name__ == "__main__": ...@@ -142,7 +150,7 @@ if __name__ == "__main__":
for i in range(1): for i in range(1):
cookies = login() cookies = logins()
Urge(cookies, id) Urge(cookies, id)
......
...@@ -21,39 +21,29 @@ def index_first(): ...@@ -21,39 +21,29 @@ def index_first():
return r1.cookies.get_dict() return r1.cookies.get_dict()
def get_majia(): def get_majia():
data = open("batch user gen") data = open("batch user gen")
list = [] list=[]
for i in data: for i in data:
list.append(i.strip('\n').strip(',')) list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500)) # time.sleep(random.randint(0, 500))
maj = random.randint(1, 300) maj = random.randint(1, len(list))
user_id = list[maj]
print(user_id)
return user_id
def login(): user_id=list[maj-1]
# time.sleep(random.randint(300, 500))
num_majia = random.randint(1, 300) return list
# user_id=majia[num_majia] def logins(id):
user = 's_PzFznI@shadow.com'
pwd = '123456'
cookies = index_first() cookies = index_first()
post_dict = { post_dict={
'account_type': 2, 'account_type':2,
'pwd': pwd, 'pwd':'123456',
'email': user 'email':id
} }
response = requests.post( response = requests.post(
url=login_url, url=login_url,
...@@ -61,7 +51,7 @@ def login(): ...@@ -61,7 +51,7 @@ def login():
cookies=cookies cookies=cookies
) )
headers = response.headers headers=response.headers
cook = headers['Set-Cookie'].split(";") cook = headers['Set-Cookie'].split(";")
...@@ -69,8 +59,6 @@ def login(): ...@@ -69,8 +59,6 @@ def login():
print(response.text, 'url') print(response.text, 'url')
print(cook)
return {'sessionid': cook} return {'sessionid': cook}
def pick(cookies_get,id): def pick(cookies_get,id):
...@@ -120,7 +108,7 @@ if __name__ == "__main__": ...@@ -120,7 +108,7 @@ if __name__ == "__main__":
for i in range(urge_num): for i in range(urge_num):
cookies = index_first() cookies = index_first()
cook = login() cook = logins()
pick(cook, id) pick(cook, 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