Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cybertron
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
cybertron
Commits
b0c66013
Commit
b0c66013
authored
Dec 07, 2018
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
majia new
parent
9c0bd0c3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
590 additions
and
266 deletions
+590
-266
workspace.xml
.idea/workspace.xml
+0
-0
auto_at_once.py
auto_at_once.py
+85
-14
auto_click.py
auto_click.py
+41
-23
auto_click_n.py
auto_click_n.py
+42
-33
auto_commnet.py
auto_commnet.py
+24
-28
auto_every.py
auto_every.py
+171
-0
auto_follow.py
auto_follow.py
+17
-27
auto_pick.py
auto_pick.py
+70
-18
auto_star_topic.py
auto_star_topic.py
+39
-92
auto_urge.py
auto_urge.py
+44
-31
exercise.py
exercise.py
+57
-0
No files found.
.idea/workspace.xml
View file @
b0c66013
This diff is collapsed.
Click to expand it.
a
otu
_at_once.py
→
a
uto
_at_once.py
View file @
b0c66013
...
...
@@ -50,6 +50,31 @@ def login():
return
{
'sessionid'
:
cook
}
def
logins
(
id
):
cookies
=
index_first
()
post_dict
=
{
'account_type'
:
2
,
'pwd'
:
'123456'
,
'email'
:
id
}
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
,
...
...
@@ -61,7 +86,7 @@ def follow(cookies_get, id):
print
(
response
.
text
,
'url'
)
def
dz
(
cookies_get
,
id
):
def
click
(
cookies_get
,
id
):
post_dict
=
{
'type'
:
1
,
'id'
:
id
...
...
@@ -77,7 +102,7 @@ def reply(cookies_get,id,content):
'topic_id'
:
id
,
'content'
:
content
}
response
=
requests
.
ge
t
(
url
=
auto_click_url
,
response
=
requests
.
pos
t
(
url
=
auto_click_url
,
cookies
=
cookies_get
,
data
=
post_dict
)
...
...
@@ -89,7 +114,7 @@ def time_conv():
yes_time_str
=
now
.
strftime
(
'
%
Y-
%
m-
%
d'
)
return
yes_time_str
def
get_
data
(
numtime
):
def
get_
topic_id
(
numtime
):
db
=
pymysql
.
connect
(
host
=
"rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com"
,
user
=
'work'
,
passwd
=
'Gengmei123'
,
db
=
"alpha"
,
port
=
3306
)
...
...
@@ -117,35 +142,81 @@ def get_comment():
return
comment
def
get_follw_majia
(
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
()
numtime
=
time_conv
(
0
)
user_id
=
get_data
(
numtime
)
topic_id
=
get_topic_id
(
numtime
)
for
j
in
user
_id
:
for
j
in
topic
_id
:
id
=
int
(
j
[
0
])
num
=
random
.
randint
(
0
,
2
)
click_num
=
random
.
randint
(
1
,
5
)
if
num
==
0
:
for
i
in
range
(
click_num
)
:
cookies
=
login
(
)
# time.sleep(random.randint(500, 1500)
)
co
mment
=
get_comment
()
co
okies
=
login
()
reply
(
cookies
,
id
,
comment
)
click
(
cookies
,
id
)
if
num
==
1
:
# time.sleep(random.randint(500, 1500))
cookies
=
login
()
comment_num
=
random
.
randint
(
1
,
3
)
for
i
in
range
(
comment_num
):
dz
(
cookies
,
id
)
# time.sleep(random.randint(500, 1500))
cookies
=
login
()
comment
=
get_comment
()
reply
(
cookies
,
id
,
comment
)
#get majia zhanghao
data
=
get_follw_majia
(
numtime
,
id
)
dict
=
{}
for
i
in
data
:
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
():
cookies
=
logins
(
key
)
for
id
in
value
:
follow
(
cookies
,
id
)
auto_click.py
View file @
b0c66013
...
...
@@ -4,11 +4,11 @@ import datetime
import
pymysql
import
random
s
=
requests
.
session
()
s
.
keep_alive
=
False
requests
.
adapters
.
DEFAULT_RETRIES
=
5
#
s = requests.session()
#
#
s.keep_alive = False
#
#
requests.adapters.DEFAULT_RETRIES = 5
auto_click_url
=
"http://earth.igengmei.com/api/v1/like"
...
...
@@ -22,6 +22,18 @@ def index_first():
def
login
(
cookies
,
user
,
pwd
):
# time.sleep(random.randint(300, 500))
maj
=
random
.
randint
(
1
,
300
)
# user_id=majia[maj]
user
=
's_PzFznI@shadow.com'
pwd
=
'123456'
cookies
=
index_first
()
post_dict
=
{
'account_type'
:
2
,
'pwd'
:
pwd
,
...
...
@@ -45,7 +57,7 @@ def login(cookies,user,pwd):
return
{
'sessionid'
:
cook
}
def
dz
(
cookies_get
,
id
):
def
click
(
cookies_get
,
id
):
post_dict
=
{
'type'
:
1
,
...
...
@@ -57,7 +69,6 @@ def dz(cookies_get, id):
print
(
response
.
text
,
'url'
)
def
time_conv
(
numtime
):
now
=
datetime
.
datetime
.
now
()
...
...
@@ -70,48 +81,55 @@ def get_data(numtime):
db
=
"alpha"
,
port
=
3306
)
cursor
=
db
.
cursor
()
print
(
"---------"
)
cursor
.
execute
(
"SELECT id FROM topic WHERE create_time LIKE '
%%%%%
s
%%%%
'"
%
numtime
)
cursor
.
execute
(
"SELECT
user_id,
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__"
:
time_list
=
[
1
,
3
,
5
,
7
,
15
,
21
,
28
,
35
]
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
for
i
in
range
(
len
(
time_list
))
:
for
i
in
time_list
:
#time.sleep(random.randint(3000,4500))
numtime
=
time_conv
(
time_list
[
i
]
)
numtime
=
time_conv
(
i
)
user_id
=
get_data
(
numtime
)
for
j
in
user_id
:
dict
=
{}
id
=
int
(
j
[
0
])
for
i
in
user_id
:
#time.sleep(random.randint(200,500))
if
i
[
0
]
not
in
dict
.
keys
():
dict
.
setdefault
(
i
[
0
],
[])
dict
[
i
[
0
]]
.
append
(
i
[
1
])
num_cishu
=
random
.
randint
(
0
,
1
)
else
:
dict
[
i
[
0
]]
.
append
(
i
[
1
])
if
num_cishu
==
1
:
for
key
,
value
in
dict
.
items
()
:
num_majia
=
random
.
randint
(
1
,
300
)
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
# user_id=majia[num_majia
]
rand_id
=
value
[
rand_num
]
user
=
's_AzAfOj@shadow.com'
urge_num
=
random
.
randint
(
0
,
1
)
pwd
=
'123456'
for
i
in
range
(
urge_num
):
cookies
=
index_first
()
cook
=
login
(
cookies
,
user
,
pwd
)
cook
=
login
()
click
(
cook
,
rand_id
)
dz
(
cook
,
id
)
auto_
follow_majia
.py
→
auto_
click_n
.py
View file @
b0c66013
...
...
@@ -4,25 +4,25 @@ 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
"
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
():
def
login
(
cookies
,
user
,
pwd
):
# time.sleep(random.randint(300, 500))
num_majia
=
random
.
randint
(
1
,
300
)
...
...
@@ -53,68 +53,77 @@ def login():
print
(
response
.
text
,
'url'
)
print
(
cook
)
return
{
'sessionid'
:
cook
}
def
follow
(
cookies_get
,
id
):
def
click
(
cookies_get
,
id
):
post_dict
=
{
'type'
:
1
,
'id'
:
id
}
response
=
requests
.
post
(
url
=
auto_
follow
_url
,
response
=
requests
.
post
(
url
=
auto_
click
_url
,
cookies
=
cookies_get
,
data
=
post_dict
)
print
(
response
.
text
,
'url'
)
def
time_conv
():
def
time_conv
(
numtime
):
now
=
datetime
.
datetime
.
now
()
yes_time
_str
=
now
.
strftime
(
'
%
Y-
%
m-
%
d'
)
print
(
now
)
yes_time
=
now
-
datetime
.
timedelta
(
days
=
numtime
)
yes_time_str
=
yes_time
.
strftime
(
'
%
Y-
%
m-
%
d'
)
return
yes_time_str
def
get_data
(
numtime
,
id
):
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 user_id,follow_id FROM user_follow WHERE update_time LIKE '
%%%%%
s
%%%%
' and user_id in '
%%%%
s
%%%%
' "
%
(
numtime
,
id
))
cursor
.
execute
(
"SELECT user_id,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
print
(
"Database version :
%
s "
%
data
)
if
__name__
==
"__main__"
:
db
.
close
()
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
return
data
for
i
in
time_list
:
if
__name__
==
"__main__"
:
#time.sleep(random.randint(3000,4500))
numtime
=
time_conv
(
)
numtime
=
time_conv
(
7
+
3
*
i
)
data
=
get_data
(
numtime
,
id
)
user_id
=
get_data
(
numtime
)
dict
=
{}
dict
=
{}
for
i
in
data
.
values
:
for
i
in
user_id
:
if
i
[
0
]
not
in
dict
:
dict
.
setdefault
(
i
[
0
],
[])
dict
[
i
[
0
]]
.
append
(
i
[
1
])
if
i
[
0
]
not
in
dict
.
keys
()
:
dict
.
setdefault
(
i
[
0
],
[])
dict
[
i
[
0
]]
.
append
(
i
[
1
])
else
:
dict
[
i
[
0
]]
.
append
(
i
[
1
])
else
:
dict
[
i
[
0
]]
.
append
(
i
[
1
])
for
key
,
value
in
dict
.
items
():
for
key
,
value
in
dict
.
items
():
cookies
=
login
(
)
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
for
id
in
value
:
rand_id
=
value
[
rand_num
]
follow
(
cookies
,
id
)
urge_num
=
random
.
randint
(
0
,
1
)
for
i
in
range
(
urge_num
):
cookies
=
index_first
()
cook
=
login
()
click
(
cook
,
rand_id
)
auto_commnet.py
View file @
b0c66013
...
...
@@ -17,7 +17,17 @@ 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_FF3qUO@shadow.com'
pwd
=
'123456'
cookies
=
index_first
()
post_dict
=
{
'account_type'
:
2
,
...
...
@@ -43,6 +53,7 @@ def login(cookies,user,pwd):
return
{
'sessionid'
:
cook
}
def
reply
(
cookies_get
,
id
,
content
):
post_dict
=
{
'topic_id'
:
id
,
'content'
:
content
...
...
@@ -60,19 +71,19 @@ def time_conv(numtime):
yes_time_str
=
yes_time
.
strftime
(
'
%
Y-
%
m-
%
d'
)
return
yes_time_str
def
get_
data
(
numtime
):
def
get_
topic_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 id FROM topic WHERE create_time LIKE '
%%%%%
s
%%%%
' "
%
numtime
)
data
=
cursor
.
fetchall
()
user
_id
=
list
(
data
)
topic
_id
=
list
(
data
)
print
(
"Database version :
%
s "
%
user
_id
)
print
(
"Database version :
%
s "
%
topic
_id
)
db
.
close
()
return
user
_id
return
topic
_id
def
get_comment
():
...
...
@@ -91,35 +102,20 @@ def get_comment():
if
__name__
==
"__main__"
:
time_list
=
[
1
,
3
,
5
,
7
]
for
i
in
range
(
len
(
time_list
)):
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
#time.sleep(random.randint(5000,6500))
for
i
in
time_list
:
numtime
=
time_conv
(
time_list
[
i
]
)
#time.sleep(random.randint(500,1500)
)
user_id
=
get_data
(
numtime
)
numtime
=
time_conv
(
i
)
for
j
in
user_id
:
topic_id
=
get_topic_id
(
numtime
)
id
=
int
(
j
[
0
])
for
i
in
topic_id
:
# time.sleep(random.randint(300, 700))
num_majia
=
random
.
randint
(
1
,
300
)
cookies
=
index_first
()
# user_id=majia[num]
user
=
's_AzAfOj@shadow.com'
pwd
=
'123456'
cook
=
login
(
cookies
,
user
,
pwd
)
cook
=
login
()
comment
=
get_comment
()
reply
(
cook
,
id
,
comment
)
reply
(
cook
,
i
,
comment
)
auto_every.py
0 → 100644
View file @
b0c66013
import
requests
import
time
import
datetime
import
pymysql
import
random
auto_follow_url
=
"http://earth.igengmei.com/api/v1/follow"
login_url
=
"http://earth.igengmei.com/api/account/login_pwd"
auto_pick_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
():
# 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'
:
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
,
'id'
:
id
}
response
=
requests
.
post
(
url
=
auto_follow_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
.
post
(
url
=
auto_pick_url
,
cookies
=
cookies_get
,
data
=
post_dict
)
print
(
response
.
headers
)
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_topic_new_user
(
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 topic WHERE create_time LIKE '
%%%%%
s
%%%%
'"
%
numtime
)
topic_data
=
cursor
.
fetchall
()
cursor
.
execute
(
"SELECT user_id FROM group_follow WHERE create_time LIKE '
%%%%%
s
%%%%
'"
%
numtime
)
new_user_data
=
cursor
.
fetchall
()
topic_data
=
list
(
topic_data
)
new_user_data
=
list
(
new_user_data
)
user_id
=
[]
for
i
in
topic_data
:
user_id
.
append
(
i
)
for
i
in
new_user_data
:
user_id
.
append
(
i
)
print
(
"Database version :
%
s "
%
user_id
)
db
.
close
()
return
user_id
def
get_topic_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 user_id,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__"
:
numtime
=
time_conv
(
0
)
user_id
=
get_topic_new_user
(
numtime
)
for
j
in
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
1
,
2
)
for
i
in
range
(
follow_num
):
# time.sleep(random.randint(500, 1500))
cookies
=
login
()
follow
(
cookies
,
id
)
user_id
=
get_topic_data
(
numtime
)
for
j
in
user_id
:
id
=
int
(
j
[
0
])
follow_num
=
random
.
randint
(
1
,
10
)
for
i
in
range
(
follow_num
):
# time.sleep(random.randint(500, 1500))
cookies
=
login
()
pick
(
cookies
,
id
)
# 1.当天发帖:[1-2]个粉丝
# 0.当日加组的用户:[1-2」个粉丝
# 0.当天:[1-10]个pick
\ No newline at end of file
auto_follow.py
View file @
b0c66013
...
...
@@ -4,29 +4,17 @@ 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
():
time
.
sleep
(
random
.
randint
(
300
,
500
))
#
time.sleep(random.randint(300, 500))
num_majia
=
random
.
randint
(
1
,
300
)
...
...
@@ -93,7 +81,6 @@ def get_data(numtime):
db
.
close
()
return
user_id
#(0-1)
def
get_commnet_id
(
numtime
):
db
=
pymysql
.
connect
(
host
=
"rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com"
,
user
=
'work'
,
passwd
=
'Gengmei123'
,
...
...
@@ -143,36 +130,37 @@ def get_commnet_id(numtime):
return
user_id
if
__name__
==
"__main__"
:
time_list
=
[
1
,
2
,
7
,
30
,
5
]
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
11
]
for
i
in
range
(
len
(
time_list
))
:
for
i
in
time_list
:
if
time_list
[
i
]
==
5
:
if
time_list
[
i
]
!=
11
:
numtime
=
time_conv
(
time_list
[
1
]
)
numtime
=
time_conv
(
i
)
user_id
=
get_
commnet_id
(
numtime
)
user_id
=
get_
data
(
numtime
)
for
j
in
user_id
:
id
=
int
(
j
[
0
])
num_cishu
=
random
.
randint
(
0
,
1
)
follow_num
=
random
.
randint
(
1
,
2
)
for
i
in
range
(
num_cishu
):
for
i
in
range
(
follow_num
):
# time.sleep(random.randint(500, 1500))
cookies
=
login
()
follow
(
cookies
,
id
)
time
.
sleep
(
random
.
randint
(
2000
,
2500
))
#
time.sleep(random.randint(2000,2500))
else
:
numtime
=
time_conv
(
time_list
[
i
]
)
numtime
=
time_conv
(
1
)
user_id
=
get_data
(
numtime
)
...
...
@@ -180,15 +168,17 @@ if __name__ == "__main__":
id
=
int
(
j
[
0
])
num_cishu
=
random
.
randint
(
1
,
2
)
follow_num
=
random
.
randint
(
0
,
1
)
# time.sleep(random.randint(500, 1500))
for
i
in
range
(
num_cishu
):
for
i
in
range
(
follow_num
):
cookies
=
login
()
follow
(
cookies
,
id
)
time
.
sleep
(
random
.
randint
(
2000
,
3000
))
#
time.sleep(random.randint(2000, 3000))
...
...
auto_pick.py
View file @
b0c66013
...
...
@@ -4,7 +4,7 @@ import datetime
import
pymysql
import
random
auto_
cl
ick_url
=
"http://earth.igengmei.com/api/v1/pick/do_pick"
auto_
p
ick_url
=
"http://earth.igengmei.com/api/v1/pick/do_pick"
login_url
=
"http://earth.igengmei.com/api/account/login_pwd"
...
...
@@ -47,18 +47,19 @@ def login():
return
{
'sessionid'
:
cook
}
def
pick
(
cookies_get
,
id
,
content
):
def
pick
(
cookies_get
,
id
):
post_dict
=
{
'pick_user_id'
:
id
,
'is_pick'
:
1
,
'pick_type'
:
0
}
response
=
requests
.
get
(
url
=
auto_cl
ick_url
,
response
=
requests
.
post
(
url
=
auto_p
ick_url
,
cookies
=
cookies_get
,
data
=
post_dict
)
print
(
response
.
text
,
'url'
)
print
(
response
.
headers
)
print
(
response
.
text
,
'url'
)
def
time_conv
(
numtime
):
...
...
@@ -68,7 +69,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
)
...
...
@@ -89,7 +89,6 @@ def get_data(numtime):
return
user_id
def
get_new_user_id
(
numtime
):
db
=
pymysql
.
connect
(
host
=
"rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com"
,
user
=
'work'
,
passwd
=
'Gengmei123'
,
...
...
@@ -112,14 +111,34 @@ def get_new_user_id(numtime):
return
user_id
def
get_star_useid
(
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
if
__name__
==
"__main__"
:
time_list
=
[
1
,
3
,
4
]
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
#topic
for
i
in
range
(
2
)
:
for
i
in
time_list
:
numtime
=
time_conv
(
time_list
[
i
]
)
numtime
=
time_conv
(
i
)
user_id
=
get_data
(
numtime
)
...
...
@@ -127,31 +146,64 @@ if __name__ == "__main__":
id
=
int
(
j
[
0
])
num_cishu
=
random
.
randint
(
1
,
2
)
# time.sleep(random.randint(200,500))
pick_num
=
random
.
randint
(
1
,
2
)
for
i
in
range
(
num_cishu
):
for
i
in
range
(
pick_num
):
cookies
=
login
()
pick
(
cookies
,
id
)
time
.
sleep
(
random
.
randint
(
3000
,
5000
))
# time.sleep(random.randint(500, 1000))
#star
for
i
in
time_list
:
numtime
=
time_conv
(
i
)
user_id
=
get_star_useid
(
numtime
)
new_user_id
=
get_new_user_id
(
1
)
for
j
in
user_id
:
tie_user_id
=
get_data
(
1
)
id
=
int
(
j
[
0
]
)
for
i
in
new_user_id
:
# time.sleep(random.randint(200,500))
for
j
in
tie_user_id
:
pick_num
=
random
.
randint
(
1
,
5
)
if
i
==
j
:
for
i
in
range
(
pick_num
)
:
cookies
=
login
(
cookies
,
user
=
cookies
,
pwd
=
''
)
cookies
=
login
(
)
pick
(
cookies
,
id
)
# time.sleep(random.randint(500, 1000))
for
i
in
time_list
:
if
i
==
1
:
numtime
=
time_conv
(
1
)
topic_user_id
=
get_data
(
numtime
)
new_user_id
=
get_new_user_id
(
numtime
)
for
i
in
new_user_id
:
for
j
in
topic_user_id
:
if
i
==
j
:
pick_num
=
random
.
randint
(
0
,
1
)
for
x
in
range
(
pick_num
):
cookies
=
login
()
pick
(
cookies
,
i
)
auto_
click_star
.py
→
auto_
star_topic
.py
View file @
b0c66013
...
...
@@ -3,18 +3,12 @@ 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
# s = requests.session()
#
# s.keep_alive = False
#
# requests.adapters.DEFAULT_RETRIES = 5
auto_follow_url
=
"http://earth.igengmei.com/api/v1/follow"
...
...
@@ -22,28 +16,26 @@ 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
():
return
r1
.
cookies
.
get_dict
()
# time.sleep(random.randint(300, 700))
def
login
(
cookies
,
user
,
pwd
):
num_majia
=
random
.
randint
(
1
,
300
)
# time.sleep(random.randint(300, 500)
)
cookies
=
index_first
(
)
maj
=
random
.
randint
(
1
,
300
)
# user_id=majia[
num
]
# user_id=majia[
maj
]
user
=
's_PzFznI@shadow.com'
pwd
=
'123456'
cookies
=
index_first
()
post_dict
=
{
'account_type'
:
2
,
'pwd'
:
pwd
,
...
...
@@ -63,9 +55,12 @@ def login():
print
(
response
.
text
,
'url'
)
print
(
cook
)
return
{
'sessionid'
:
cook
}
def
dz
(
cookies_get
,
id
):
def
click
(
cookies_get
,
id
):
post_dict
=
{
'type'
:
1
,
'id'
:
id
...
...
@@ -82,61 +77,32 @@ def follow(cookies_get, id):
'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
):
def
get_star_user_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 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_t
ie
id
(
numtime
):
def
get_star_t
opic_
id
(
numtime
):
db
=
pymysql
.
connect
(
host
=
"rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com"
,
user
=
'work'
,
passwd
=
'Gengmei123'
,
db
=
"alpha"
,
port
=
3306
)
...
...
@@ -155,62 +121,43 @@ def get_star_tieid(numtime):
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
):
cookies
=
login
()
dz
(
cookies
,
id
)
elif
num
==
3
or
num
==
7
:
user_id
=
get_star_tieid
(
numtime
)
numtime
=
time_conv
(
1
)
for
i
in
user_id
:
topic_id
=
get_star_topic_id
(
numtime
)
num_cishu
=
random
.
randint
(
1
,
2
)
for
j
in
topic_id
:
for
j
in
range
(
num_cishu
):
id
=
int
(
j
[
0
])
cookies
=
login
(
)
# time.sleep(random.randint(200,500)
)
dz
(
cookies
,
id
)
urge_num
=
random
.
randint
(
0
,
1
)
else
:
for
i
in
range
(
urge_num
)
:
user_id
=
get_star_userid
(
numtime
)
cookies
=
login
(
)
for
i
in
user_id
:
click
(
cookies
,
id
)
num_cishu
=
random
.
randint
(
1
,
5
)
# time.sleep(random.randint(500, 1000)
)
for
j
in
range
(
num_cishu
):
user_id
=
get_star_user_id
(
numtime
)
cookies
=
login
()
for
j
in
user_id
:
follow
(
cookies
,
id
)
id
=
int
(
j
[
0
]
)
Urge
(
cookies
,
id
)
# time.sleep(random.randint(200,500)
)
pick
(
cookies
,
id
)
urge_num
=
random
.
randint
(
1
,
2
)
for
i
in
range
(
urge_num
):
cookies
=
login
()
follow
(
cookies
,
id
)
# time.sleep(random.randint(500, 1000))
auto_urge.py
View file @
b0c66013
...
...
@@ -5,28 +5,15 @@ import pymysql
import
random
import
pandas
as
pd
cookies
=
{
"sessionid"
:
'6'
,
}
s
=
requests
.
session
()
s
.
keep_alive
=
False
requests
.
adapters
.
DEFAULT_RETRIES
=
5
auto_urge_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
():
num_majia
=
random
.
randint
(
1
,
300
)
...
...
@@ -60,10 +47,9 @@ def login():
return
{
'sessionid'
:
cook
}
def
Urge
(
cookies_get
,
id
,
comment
):
def
Urge
(
cookies_get
,
id
):
post_dict
=
{
'id'
:
id
,
'comment'
:
comment
'id'
:
id
}
response
=
requests
.
post
(
url
=
auto_urge_url
,
cookies
=
cookies_get
,
...
...
@@ -96,14 +82,32 @@ def get_data(numtime):
return
user_id
def
get_star_useid
(
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
if
__name__
==
"__main__"
:
time_list
=
[
1
,
3
,
7
]
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
for
i
in
range
(
len
(
time_list
))
:
for
i
in
time_list
:
numtime
=
time_conv
(
time_list
[
i
]
)
numtime
=
time_conv
(
i
)
user_id
=
get_data
(
numtime
)
...
...
@@ -111,27 +115,35 @@ if __name__ == "__main__":
id
=
int
(
j
[
0
])
time
.
sleep
(
random
.
randint
(
200
,
500
))
#
time.sleep(random.randint(200,500))
num_cishu
=
random
.
randint
(
0
,
2
)
urge_num
=
random
.
randint
(
0
,
2
)
if
num_cishu
==
0
and
time_list
[
i
]
==
1
:
for
i
in
range
(
urge_num
)
:
pass
cookies
=
login
()
elif
num_cishu
==
1
:
Urge
(
cookies
,
id
)
login
(
)
# time.sleep(random.randint(500, 1000)
)
Urge
(
cookies
,
id
)
else
:
for
i
in
time_list
:
for
i
in
range
(
num_cishu
):
numtime
=
time_conv
(
i
)
cookies
=
login
(
)
user_id
=
get_star_useid
(
numtime
)
Urge
(
cookies
,
id
)
for
j
in
user_id
:
id
=
int
(
j
[
0
])
# time.sleep(random.randint(200,500))
time
.
sleep
(
random
.
randint
(
2000
,
3000
))
for
i
in
range
(
1
):
cookies
=
login
()
Urge
(
cookies
,
id
)
# time.sleep(random.randint(500, 1000))
\ No newline at end of file
exercise.py
0 → 100644
View file @
b0c66013
#
#
# import pandas as pd
#
# data=[(1, 1), (3, 1), (5, 241406349), (258, 241406352), (259, 1543475229), (260, 1543290924),
# (261, 1543290924), (262, 1543575727), (263, 1543575727), (264, 241406387), (265, 241406387),
# (266, 1543291223), (267, 1543290924), (268, 1543290924), (269, 1543290924), (270, 1543291223),
# (271, 1543291223), (272, 1543291223), (273, 1543291223), (274, 1543291223), (275, 1543291223),
# (276, 1543482718), (277, 1543482718), (278, 1543291223), (279, 1543482718), (280, 1543482718),
# (281, 1543482718), (282, 241406349), (283, 1543482718), (284, 241406397), (285, 1543291223),
# (286, 2018113010044082), (287, 2018113010044082), (288, 1542943961), (289, 1542943961),
# (290, 1543388936), (291, 1543388936), (292, 1542943961), (293, 1543388936), (294, 1543291223),
# (295, 1543291223), (296, 1543482718), (297, 1543482718), (298, 1543291223), (299, 1543291223),
# (300, 1543475229), (301, 1543482718), (302, 1543221193), (303, 241406399),
# (304, 1543475229), (305, 241406398), (306, 241406398), (307, 1543475229), (308, 241406356),
# (309, 1543290924), (310, 1543290924), (311, 1543290924), (312, 5), (313, 1543290924), (314, 1543291223),
# (315, 1543291223), (316, 1543475229), (317, 1543291223), (318, 1543475229), (319, 1543290924),
# (320, 1543291223), (321, 1543291223), (322, 1543291223), (323, 241406385), (324, 241406385),
# (325, 6), (326, 241406385), (327, 241406385), (328, 1542943961), (329, 241406397), (330, 1543291223),
# (331, 1542943961), (332, 1542943961), (333, 1543291223), (334, 1542943961), (335, 1543291223)
# (336, 1543291223), (337, 1542943961), (338, 1543291223), (339, 1543290924), (340, 1542943961),
# (341, 1542943961), (342, 1543290924), (343, 1543291223), (344, 1543290924), (345, 1543290924),
# (346, 1543291223), (347, 1543291223), (348, 1542943961), (349, 1542943961), (350, 1543290924),
# (351, 1543290924), (352, 1543290924), (353, 1543290924), (354, 1542943961), (355, 1542943961),
# (356, 1542943961), (357, 1542943961), (358, 1542943961), (359, 1542943961), (360, 1542943961), (361, 1542943961), (362, 1542943961), (363, 241406349), (364, 241406349), (365, 1543290924), (366, 1543291223), (367, 1543291223), (368, 1543291223), (369, 1543291223), (370, 1543291223), (371, 1543291223), (372, 1543290924), (373, 1543290924), (374, 1543290924), (375, 1543290924), (376, 1543290924), (377, 1543290924), (378, 1543290924), (379, 241406414), (380, 1543290924), (381, 1543290924), (382, 1543291223), (383, 1543291223), (384, 1543291223), (385, 1543291223), (386, 1543291223), (387, 1543290924), (388, 1543290924)]
#
#
# dict={}
#
# for i in data:
# if i[1] not in dict.keys():
# dict.setdefault(i[1],[])
# dict[i[1]].append(i[0])
#
# else:
# dict[i[1]].append(i[0])
import
random
list
=
{
"key"
:[
259
,
300
,
304
,
307
,
316
,
318
]}
for
key
,
value
in
list
.
items
():
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
rand_id
=
value
[
rand_num
]
print
(
rand_id
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment