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
8efe5979
Commit
8efe5979
authored
Apr 23, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
01c5508f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
90 deletions
+110
-90
workspace.xml
.idea/workspace.xml
+0
-0
auto_click.py
auto_click.py
+33
-32
auto_click_n.py
auto_click_n.py
+29
-29
auto_follow_majia.py
auto_follow_majia.py
+20
-24
auto_follow_one.py
auto_follow_one.py
+2
-3
auto_request.py
auto_request.py
+9
-2
testss.py
testss.py
+17
-0
No files found.
.idea/workspace.xml
View file @
8efe5979
This diff is collapsed.
Click to expand it.
auto_click.py
View file @
8efe5979
...
...
@@ -8,26 +8,27 @@ from auto_request import login, click, time_convs
from
auto_request
import
host
,
user
,
db
,
passwd
def
get_data
(
numtime
):
def
get_data
(
numtime
,
numtime2
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '
%%%%%
s
%%%%
'"
%
numtime
)
"SELECT user_id,id FROM topic WHERE is_online=1 and create_time > '
%
s' and create_time < '
%
s'"
%
(
numtime
,
numtime2
))
data
=
cursor
.
fetchall
()
topic_id
=
list
(
data
)
topic_id_list
=
[]
if
topic_id
:
for
i
in
topic_id
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0"
)
data
=
cursor
.
fetchall
(
)
user_id
=
list
(
data
)
if
user_id
:
topic_id_list
.
append
(
i
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
return
topic_id_list
for
i
in
topic_id
and
topic_id
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0"
)
data
=
cursor
.
fetchall
(
)
user_id
=
list
(
data
)
if
user_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
[]
...
...
@@ -41,39 +42,39 @@ if __name__ == "__main__":
for
i
in
time_list
:
numtime
=
time_convs
(
i
)
numtime
,
numtime2
=
time_convs
(
i
+
1
,
i
-
1
)
logging
.
info
(
"get numtime :
%
s "
%
numtime
)
logging
.
info
(
"get numtime2 :
%
s"
%
numtime2
)
user_id
=
get_data
(
numtime
)
user_id
=
get_data
(
numtime
,
numtime2
)
dicts
=
{}
if
user_id
:
for
i
in
user_id
:
for
i
in
user_id
and
user_id
:
if
i
[
0
]
not
in
dicts
.
keys
():
dicts
.
setdefault
(
i
[
0
],
[])
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
if
i
[
0
]
not
in
dicts
.
keys
():
dicts
.
setdefault
(
i
[
0
],
[])
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
else
:
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
else
:
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
for
key
,
value
in
dicts
.
items
():
for
key
,
value
in
dicts
.
items
():
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
rand_id
=
value
[
rand_num
]
rand_id
=
value
[
rand_num
]
urge_num
=
random
.
randint
(
0
,
1
)
urge_num
=
random
.
randint
(
0
,
1
)
for
i
in
range
(
urge_num
):
for
i
in
range
(
urge_num
):
time
.
sleep
(
random
.
randint
(
1
,
10
))
time
.
sleep
(
random
.
randint
(
1
,
10
))
cook
=
login
()
cook
=
login
()
if
cook
is
not
None
:
click
(
cook
,
rand_id
)
if
cook
is
not
None
:
click
(
cook
,
rand_id
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
auto_click_n.py
View file @
8efe5979
...
...
@@ -9,27 +9,26 @@ from auto_request import login, click, time_convs
from
auto_request
import
host
,
user
,
db
,
passwd
def
get_data
(
numtime
):
def
get_data
(
numtime
,
numtime2
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT user_id , id FROM topic WHERE is_online=1 and create_time
LIKE '
%%%%%
s
%%%%
' "
%
numtime
)
"SELECT user_id , id FROM topic WHERE is_online=1 and create_time
> '
%%%%%
s
%%%%
' and create_time < '
%%%%%
s
%%%%
' "
%
(
numtime
,
numtime2
)
)
data
=
cursor
.
fetchall
()
topic_id
=
list
(
data
)
topic_id_list
=
[]
if
topic_id
:
for
i
in
topic_id
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0"
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
if
user_id
:
topic_id_list
.
append
(
i
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
return
topic_id_list
for
i
in
topic_id
and
topic_id
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0"
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
if
user_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
())
...
...
@@ -50,35 +49,36 @@ if __name__ == "__main__":
dict
=
{}
if
user_id
:
for
i
in
user_id
and
user_id
:
if
i
[
0
]
not
in
dict
.
keys
():
dict
.
setdefault
(
i
[
0
],
[])
for
i
in
user_id
:
dict
[
i
[
0
]]
.
append
(
i
[
1
])
if
i
[
0
]
not
in
dict
.
keys
():
else
:
dict
[
i
[
0
]]
.
append
(
i
[
1
])
dict
.
setdefault
(
i
[
0
],
[])
for
key
,
value
in
dict
.
items
():
dict
[
i
[
0
]]
.
append
(
i
[
1
]
)
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
else
:
dict
[
i
[
0
]]
.
append
(
i
[
1
])
rand_id
=
value
[
rand_num
]
for
key
,
value
in
dict
.
items
():
urge_num
=
random
.
randint
(
0
,
1
)
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
for
i
in
range
(
urge_num
):
rand_id
=
value
[
rand_num
]
time
.
sleep
(
random
.
randint
(
1
,
10
))
urge_num
=
random
.
randint
(
0
,
1
)
cook
=
login
(
)
for
i
in
range
(
urge_num
):
if
cook
is
not
None
:
click
(
cook
,
rand_id
)
time
.
sleep
(
random
.
randint
(
1
,
10
))
cook
=
login
()
if
cook
is
not
None
:
click
(
cook
,
rand_id
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
auto_follow_majia.py
View file @
8efe5979
...
...
@@ -39,48 +39,44 @@ if __name__ == "__main__":
dict_follow_id
=
{}
if
data
:
for
j
in
data
and
data
:
for
j
in
data
:
if
j
[
2
]
!=
None
:
if
j
[
2
]
!=
None
:
if
j
[
0
]
not
in
dict_follow_id
.
keys
()
:
if
j
[
0
]
not
in
dict_follow_id
.
keys
():
dict_follow_id
.
setdefault
(
j
[
0
],
[])
dict_follow_id
.
setdefault
(
j
[
0
],
[
])
dict_follow_id
[
j
[
0
]]
.
append
(
j
[
2
])
dict_follow_id
[
j
[
0
]]
.
append
(
j
[
2
])
else
:
dict_follow_id
[
j
[
0
]]
.
append
(
j
[
2
])
else
:
dict_follow_id
[
j
[
0
]]
.
append
(
j
[
2
])
dict_email
=
{}
if
data
:
for
j
in
data
:
for
j
in
data
and
data
:
if
j
[
2
]
!=
None
:
if
j
[
2
]
!=
None
:
if
j
[
0
]
not
in
dict_email
.
keys
():
if
j
[
0
]
not
in
dict_email
.
keys
():
dict_email
.
setdefault
(
j
[
0
],
[])
dict_email
.
setdefault
(
j
[
0
],
[])
dict_email
[
j
[
0
]]
.
append
(
j
[
1
])
dict_email
[
j
[
0
]]
.
append
(
j
[
1
])
else
:
dict_email
[
j
[
0
]]
.
append
(
j
[
1
])
else
:
dict_email
[
j
[
0
]]
.
append
(
j
[
1
])
for
key
,
value
in
dict_follow_id
.
items
():
for
key
,
value
in
dict_follow_id
.
items
():
id
=
dict_email
[
key
][
0
]
id
=
dict_email
[
key
][
0
]
for
i
in
value
:
for
i
in
value
:
cookies
=
login
(
id
)
cookies
=
login
(
id
)
if
cookies
is
not
None
:
follow
(
cookies
,
i
)
if
cookies
is
not
None
:
follow
(
cookies
,
i
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
auto_follow_one.py
View file @
8efe5979
...
...
@@ -19,9 +19,8 @@ def get_data(numtime):
(
numtime
))
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
topic_id_list
=
[]
for
i
in
user_id
:
for
i
in
user_id
and
user_id
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0 "
)
data
=
cursor
.
fetchall
()
...
...
@@ -47,7 +46,7 @@ if __name__ == "__main__":
for
j
in
range
(
urge_num
):
for
i
in
user_id
:
for
i
in
user_id
and
user_id
:
cookies
=
get_cookies
(
i
)
...
...
auto_request.py
View file @
8efe5979
...
...
@@ -137,12 +137,19 @@ def time_conv(minutest):
return
None
def
time_convs
(
numtime
):
def
time_convs
(
numtime
,
numtime2
):
try
:
now
=
datetime
.
datetime
.
now
()
yes_time
=
now
-
datetime
.
timedelta
(
days
=
numtime
)
yes_time_str
=
yes_time
.
strftime
(
'
%
Y-
%
m-
%
d'
)
return
yes_time_str
yes_time_str
=
yes_time_str
+
' 23:59:59.000000'
yes_time2
=
now
-
datetime
.
timedelta
(
days
=
numtime2
)
yes_time_str2
=
yes_time2
.
strftime
(
'
%
Y-
%
m-
%
d'
)
yes_time_str2
=
yes_time_str2
+
' 00:00:00.000000'
return
yes_time_str
,
yes_time_str2
except
:
return
None
...
...
testss.py
0 → 100644
View file @
8efe5979
import
datetime
now
=
datetime
.
datetime
.
now
()
yes_time
=
now
-
datetime
.
timedelta
(
days
=
2
)
yes_time_str
=
yes_time
.
strftime
(
'
%
Y-
%
m-
%
d'
)
yes_time_str
=
yes_time_str
+
' 23:59:59.000000'
yes_time2
=
now
-
datetime
.
timedelta
(
days
=
0
)
yes_time_str2
=
yes_time2
.
strftime
(
'
%
Y-
%
m-
%
d'
)
yes_time_str2
=
yes_time_str2
+
' 00:00:00.000000'
print
(
yes_time_str
)
print
(
yes_time_str2
)
\ No newline at end of file
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