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
1
Merge Requests
1
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
saturn
Commits
729d99ea
Commit
729d99ea
authored
5 years ago
by
钟尚武
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/weibo' into 'test'
fix See merge request
!103
parents
a00c0abc
238020e2
test
deploy/like-test
No related merge requests found
Show 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 @
729d99ea
""" 微博帖子入库榜单脚本 """
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
()
...
...
This diff is collapsed.
Click to expand it.
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