Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
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
赵磊
saturn
Commits
238020e2
Commit
238020e2
authored
Aug 23, 2019
by
zhongshangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
9df8c75a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
weibo_commands.py
api/management/commands/weibo_commands.py
+10
-8
No files found.
api/management/commands/weibo_commands.py
View file @
238020e2
""" 微博帖子入库榜单脚本 """
from
co
import
time
import
os
import
re
from
datetime
import
datetime
from
collections
import
defaultdict
import
json
import
requests
from
random
import
randint
...
...
@@ -15,7 +17,7 @@ from engine.logger import info_logger, error_logger, logging_exception
IMAGE_SUFFIX
=
'-w'
FILE_PATH
=
'/
Users/zhongshangwu/workspace/gengmei/like
/saturn/weibo/'
FILE_PATH
=
'/
srv/apps
/saturn/weibo/'
class
Command
(
BaseCommand
):
...
...
@@ -132,13 +134,13 @@ class Command(BaseCommand):
return
comment
,
replies
images
=
[]
if
not
comment
[
"images"
]
and
len
(
reply
)
>
1
:
if
not
comment
[
"images"
]
and
reply
:
normal_images
=
set
(
reply
[
0
][
"images"
]
)
for
info
in
reply
[
1
:]
:
info_images
=
set
(
info
[
"images"
])
normal_images
=
normal_images
&
info_images
comment
[
"images"
]
=
list
(
normal_images
)
counter
=
defaultdict
(
int
)
for
info
in
reply
:
for
image
in
info
[
"images"
]:
counter
[
image
]
+=
1
comment
[
"images"
]
=
[
url
for
url
,
count
in
counter
if
count
>
1
]
for
info
in
reply
:
if
self
.
filter_second_comment
(
info
[
"content"
],
comment
[
"images"
],
info
[
"images"
]):
...
...
@@ -228,7 +230,7 @@ class Command(BaseCommand):
}
else
:
# -> to pictorial comment
if
len
(
self
.
stats
[
weibo_id
][
"first_comments"
])
>
50
:
if
len
(
self
.
stats
[
weibo_id
][
"first_comments"
])
>
=
50
:
continue
top_comments_obj
=
rpc_invoker
[
'venus/community/crawl/replys'
](
data
=
[
comment
],
platform
=
platform
,
pictorial_id
=
pictorial_id
)
.
unwrap
()
...
...
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