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
6050947b
Commit
6050947b
authored
Apr 18, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
77f4e958
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
215 additions
and
27 deletions
+215
-27
workspace.xml
.idea/workspace.xml
+0
-0
auto_at_once.py
auto_at_once.py
+13
-5
auto_click.py
auto_click.py
+2
-0
auto_click_n.py
auto_click_n.py
+1
-0
auto_commnet.py
auto_commnet.py
+3
-19
auto_request.py
auto_request.py
+72
-3
auto_user_id.py
auto_user_id.py
+41
-0
offline_comment.py
offline_comment.py
+83
-0
No files found.
.idea/workspace.xml
View file @
6050947b
This diff is collapsed.
Click to expand it.
auto_at_once.py
View file @
6050947b
...
...
@@ -7,7 +7,7 @@ import pandas as pd
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
login
,
reply
,
click
,
get_comment
,
time_conv
from
auto_request
import
login
,
reply
,
click
,
get_comment
s
,
time_conv
from
auto_request
import
host
,
user
,
port
,
db
,
passwd
...
...
@@ -127,6 +127,7 @@ from auto_request import host, user, port, db, passwd
# except:
#
# return None
# 9,12,18,2
def
get_topic_id
(
numtime
):
...
...
@@ -156,11 +157,14 @@ if __name__ == "__main__":
click_num
=
random
.
randint
(
1
,
3
)
for
i
in
range
(
click_num
):
for
j
in
topic_id
:
id
=
int
(
j
[
0
])
cookies
=
login
()
time
.
sleep
(
random
.
randint
(
1
,
1
0
))
time
.
sleep
(
random
.
randint
(
1
0
,
2
0
))
click
(
cookies
,
id
)
...
...
@@ -168,7 +172,9 @@ if __name__ == "__main__":
topic_id
=
get_topic_id
(
numtime
)
comment_num
=
random
.
randint
(
1
,
3
)
comment_num
=
random
.
randint
(
0
,
3
)
comment_content
=
get_comments
()
for
i
in
range
(
comment_num
):
...
...
@@ -179,8 +185,10 @@ if __name__ == "__main__":
cookies
=
login
()
if
cookies
is
not
None
:
comment
=
get_comment
()
time
.
sleep
(
random
.
randint
(
1
,
10
))
comment
=
comment_content
[
i
]
time
.
sleep
(
random
.
randint
(
10
,
20
))
reply
(
cookies
,
id
,
comment
)
...
...
auto_click.py
View file @
6050947b
...
...
@@ -131,7 +131,9 @@ if __name__ == "__main__":
else
:
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
print
(
dicts
)
for
key
,
value
in
dicts
.
items
():
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
...
...
auto_click_n.py
View file @
6050947b
...
...
@@ -151,6 +151,7 @@ if __name__ == "__main__":
cook
=
login
()
if
cook
is
not
None
:
click
(
cook
,
rand_id
)
except
:
...
...
auto_commnet.py
View file @
6050947b
...
...
@@ -134,33 +134,17 @@ if __name__ == "__main__":
topic_id
=
get_topic_id
(
numtime
)
dicts
=
{}
comment
=
get_comment
()
for
i
in
topic_id
:
if
i
[
0
]
not
in
dicts
.
keys
():
dicts
.
setdefault
(
i
[
0
],
[])
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
else
:
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
for
key
,
value
in
dicts
.
items
():
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
rand_id
=
value
[
rand_num
]
for
id
in
topic_id
:
time
.
sleep
(
random
.
randint
(
1
,
10
))
cook
=
login
()
if
cook
is
not
None
:
comment
=
get_comment
()
reply
(
cook
,
rand_
id
,
comment
)
reply
(
cook
,
id
,
comment
)
except
:
...
...
auto_request.py
View file @
6050947b
...
...
@@ -29,10 +29,11 @@ auto_urge_url = "http://earth.igengmei.com/api/v1/user/urge"
# port = 3306
host
=
"rm-2zeaut61u9sm21m0b.mysql.rds.aliyuncs.com"
user
=
'work'
passwd
=
'Gengmei123'
user
=
"work"
passwd
=
"Gengmei123"
db
=
"alpha"
port
=
'3306'
port
=
"3306"
def
get_majia
():
try
:
...
...
@@ -147,7 +148,9 @@ def get_comment():
list_guanshui
=
[]
for
i
in
data
:
list_guanshui
.
append
(
i
)
num
=
random
.
randint
(
0
,
len
(
list_guanshui
))
comment
=
list_guanshui
[
num
-
1
]
return
comment
...
...
@@ -157,6 +160,32 @@ def get_comment():
return
None
def
get_comments
():
try
:
data
=
open
(
"/srv/apps/cybertron/guanshui"
,
"r"
)
list_guanshui
=
[]
for
i
in
data
:
list_guanshui
.
append
(
i
)
num1
=
random
.
randint
(
0
,
50
)
num2
=
random
.
randint
(
50
,
70
)
num3
=
random
.
randint
(
70
,
len
(
list_guanshui
))
comment1
=
list_guanshui
[
num1
-
1
]
comment2
=
list_guanshui
[
num2
-
1
]
comment3
=
list_guanshui
[
num3
-
1
]
comment_list
=
[
comment1
,
comment2
,
comment3
]
return
comment_list
except
:
return
None
def
follow
(
cookies_get
,
id
):
try
:
post_dict
=
{
...
...
@@ -188,3 +217,43 @@ def Urge(cookies_get, id):
except
:
logging
.
error
(
"catch exception,logins:
%
s"
%
traceback
.
format_exc
())
def
get_offline_comment
():
try
:
data
=
open
(
"/srv/apps/cybertron/offline_comment.txt"
,
"r"
)
list_guanshui
=
[]
for
i
in
data
:
list_guanshui
.
append
(
i
)
num1
=
random
.
randint
(
0
,
500
)
num2
=
random
.
randint
(
500
,
1000
)
num3
=
random
.
randint
(
1000
,
1500
)
num4
=
random
.
randint
(
1500
,
len
(
list_guanshui
))
comment1
=
list_guanshui
[
num1
-
1
]
comment2
=
list_guanshui
[
num2
-
1
]
comment3
=
list_guanshui
[
num3
-
1
]
comment4
=
list_guanshui
[
num4
-
1
]
comment_list
=
[
comment1
,
comment2
,
comment3
,
comment4
]
return
comment_list
except
:
return
None
def
logins
():
try
:
user_id
=
get_majia
()
cookies
=
get_cookies
(
user_id
)
if
cookies
is
not
None
:
return
{
'sessionid'
:
cookies
}
except
:
logging
.
error
(
"catch exception,logins:
%
s"
%
traceback
.
format_exc
())
return
None
auto_user_id.py
0 → 100644
View file @
6050947b
import
requests
import
time
import
datetime
import
pymysql
import
random
import
pandas
as
pd
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
host
,
user
,
port
,
db
,
passwd
def
get_data
():
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
port
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"select user_id from user_extra where is_shadow = 0"
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
pc
.
close
()
return
user_id
except
:
logging
.
error
(
"catch exception,get_data:
%
s"
%
traceback
.
format_exc
())
return
None
data
=
get_data
(
time
)
file
=
open
(
"user_id.txt"
)
for
i
in
data
:
file
.
write
(
i
)
offline_comment.py
0 → 100644
View file @
6050947b
import
requests
import
time
import
datetime
import
pymysql
import
random
import
pandas
as
pd
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
logins
,
reply
,
get_offline_comment
,
time_convs
# from auto_request import host, user, port, db, passwd
auto_click_url
=
"http://earth.igengmei.com/api/v1/like"
auto_reply_url
=
"http://earth.igengmei.com/api/v1/reply/create"
auto_follow_url
=
"http://earth.igengmei.com/api/v1/follow"
auto_urge_url
=
"http://earth.igengmei.com/api/v1/user/urge"
# 对所有马甲生产的帖子(包含历史帖子)
#
# 离线一次性插入{0,4}条评论
#
# 评论取自评论库,并自动随机关联马甲
#
# 注意需要禁止本帖作者评论
host
=
"rm-2zeaut61u9sm21m0b.mysql.rds.aliyuncs.com"
user
=
"work"
passwd
=
"Gengmei123"
db
=
"alpha"
port
=
"3306"
def
get_data
(
numtime
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
port
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT id FROM topic WHERE is_online =1 and create_time >=
%
s and (content_level = 4 or content_level = 5) and user_id in (select user_id from user_extra where is_shadow = 0)"
,
(
numtime
))
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
logging
.
info
(
"Database version :
%
s "
%
user_id
)
pc
.
close
()
return
user_id
except
:
logging
.
error
(
"catch exception,get_data:
%
s"
%
traceback
.
format_exc
())
return
None
if
__name__
==
"__main__"
:
try
:
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
for
i
in
time_list
:
numtime
=
time_convs
(
i
)
topic_id
=
get_data
(
numtime
)
dicts
=
{}
rand_num
=
random
.
randint
(
0
,
4
)
for
id
in
topic_id
:
comment_list
=
get_offline_comment
()
for
i
in
rand_num
:
cook
=
logins
()
comment
=
get_offline_comment
()
comment
=
comment_list
[
rand_num
]
reply
(
cook
,
id
,
comment
)
except
:
logging
.
error
(
"catch exception,main :
%
s"
%
traceback
.
format_exc
())
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