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
2f6b4dff
Commit
2f6b4dff
authored
Jun 28, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
48940a01
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
21 deletions
+73
-21
workspace.xml
.idea/workspace.xml
+0
-0
auto_follow.py
auto_follow.py
+9
-21
auto_follow2.py
auto_follow2.py
+64
-0
No files found.
.idea/workspace.xml
View file @
2f6b4dff
This diff is collapsed.
Click to expand it.
auto_follow.py
View file @
2f6b4dff
...
@@ -40,35 +40,23 @@ if __name__ == "__main__":
...
@@ -40,35 +40,23 @@ if __name__ == "__main__":
try
:
try
:
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
11
]
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
for
i
in
range
(
len
(
time_list
)):
numtime1
,
numtime2
=
time_convs
(
8
,
0
)
if
time_list
[
i
]
!=
11
:
user_id
=
get_data
(
numtime1
,
numtime2
)
numtime1
,
numtime2
=
time_convs
(
time_list
[
i
]
+
1
,
time_list
[
i
]
-
1
)
follow_num
=
random
.
randint
(
1
,
2
)
user_id
=
get_data
(
numtime1
,
numtime2
)
for
j
in
user_id
and
user_id
:
follow_num
=
random
.
randint
(
1
,
2
)
id
=
int
(
j
[
0
]
)
for
i
in
range
(
follow_num
):
cookies
=
login
()
try
:
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
time
.
sleep
(
random
.
randint
(
10
,
20
))
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
except
:
pass
except
:
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
auto_follow2.py
0 → 100644
View file @
2f6b4dff
import
requests
import
time
import
datetime
import
pymysql
import
random
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
login
,
time_convs
,
follow
from
auto_request
import
host
,
user
,
port
,
db
,
passwd
def
get_data
(
numtime1
,
numtime2
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time > '
%
s' and create_time < '
%
s'"
%
(
numtime1
,
numtime2
))
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
topic_id_list
=
[]
if
user_id
:
for
i
in
user_id
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0"
)
data
=
cursor
.
fetchall
()
id
=
list
(
data
)
if
id
:
topic_id_list
.
append
(
i
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
return
topic_id_list
except
:
logging
.
error
(
"catch exception,get_data:
%
s"
%
traceback
.
format_exc
())
return
[]
if
__name__
==
"__main__"
:
try
:
time_list
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
numtime1
,
numtime2
=
time_convs
(
8
,
0
)
user_id
=
get_data
(
numtime1
,
numtime2
)
follow_num
=
random
.
randint
(
0
,
1
)
if
follow_num
==
1
:
for
j
in
user_id
and
user_id
:
id
=
int
(
j
[
0
])
cookies
=
login
()
if
cookies
is
not
None
:
follow
(
cookies
,
id
)
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