|
@@ -11,6 +11,7 @@ from applications.config import Config
|
|
|
from applications.const import HistoryContentIdTaskConst
|
|
|
from applications.log import logging
|
|
|
from applications.functions.pqFunctions import publish_to_pq, get_pq_video_detail
|
|
|
+from applications.functions.get_history_oss_path import get_history_oss_path
|
|
|
from applications.functions.common import shuffle_list
|
|
|
from applications.functions.aigc import record_trace_id
|
|
|
|
|
@@ -86,7 +87,9 @@ class historyContentIdTask(object):
|
|
|
sql = f"""
|
|
|
SELECT platform, play_count, like_count, video_oss_path, cover_oss_path, user_id
|
|
|
FROM {self.article_crawler_video_table}
|
|
|
- WHERE content_id = '{content_id}' and download_status = {self.const.VIDEO_DOWNLOAD_SUCCESS_STATUS}
|
|
|
+ WHERE content_id = '{content_id}'
|
|
|
+ AND download_status = {self.const.VIDEO_DOWNLOAD_SUCCESS_STATUS}
|
|
|
+ AND is_illegal = {self.const.VIDEO_SAFE}
|
|
|
ORDER BY score DESC;
|
|
|
"""
|
|
|
res_tuple = await self.mysql_client.async_select(sql)
|
|
@@ -143,11 +146,12 @@ class historyContentIdTask(object):
|
|
|
)
|
|
|
return row_counts
|
|
|
|
|
|
- async def publish_videos_to_pq(self, trace_id, flow_pool_level, kimi_title, gh_id, download_videos, process_times):
|
|
|
+ async def publish_videos_to_pq(self, trace_id, content_id, flow_pool_level, kimi_title, gh_id, download_videos, process_times):
|
|
|
"""
|
|
|
发布至 pq
|
|
|
:param process_times:
|
|
|
:param trace_id:
|
|
|
+ :param content_id:
|
|
|
:param download_videos: 已下载的视频---> list [{}, {}, {}.... ]
|
|
|
:param gh_id: 公众号 id ---> str
|
|
|
:param kimi_title: kimi 标题 ---> str
|
|
@@ -167,10 +171,13 @@ class historyContentIdTask(object):
|
|
|
case "autoArticlePoolLevel2":
|
|
|
video_list = []
|
|
|
case "autoArticlePoolLevel1":
|
|
|
- # 头条,先不做
|
|
|
+ # 头条, 利用oss裂变效果重排序
|
|
|
+ oss_path_list = await get_history_oss_path(content_id=content_id)
|
|
|
+ if oss_path_list:
|
|
|
+ download_videos[:0] = oss_path_list
|
|
|
+
|
|
|
video_list = download_videos[:3]
|
|
|
case _:
|
|
|
- print("未传流量池信息")
|
|
|
video_list = download_videos[:3]
|
|
|
L = []
|
|
|
for video_obj in video_list:
|
|
@@ -182,7 +189,6 @@ class historyContentIdTask(object):
|
|
|
publish_response = await publish_to_pq(params)
|
|
|
video_id = publish_response['data']['id']
|
|
|
response = await get_pq_video_detail(video_id)
|
|
|
- # time.sleep(2)
|
|
|
obj = {
|
|
|
"uid": video_obj['uid'],
|
|
|
"source": video_obj['platform'],
|
|
@@ -366,7 +372,6 @@ class historyContentIdTask(object):
|
|
|
return
|
|
|
|
|
|
download_videos = await self.get_video_list(content_id=content_id)
|
|
|
- # time.sleep(3)
|
|
|
if download_videos:
|
|
|
# 修改状态为执行状态,获取该任务的锁
|
|
|
affected_rows = await self.update_content_status(
|
|
@@ -391,12 +396,13 @@ class historyContentIdTask(object):
|
|
|
)
|
|
|
return
|
|
|
try:
|
|
|
- kimi_title = await self.get_kimi_title(content_id)
|
|
|
+ kimi_title = await self.get_kimi_title(content_id)
|
|
|
await self.publish_videos_to_pq(
|
|
|
flow_pool_level=flow_pool_level,
|
|
|
kimi_title=kimi_title,
|
|
|
gh_id=gh_id,
|
|
|
trace_id=trace_id,
|
|
|
+ content_id=content_id,
|
|
|
download_videos=download_videos,
|
|
|
process_times=process_times
|
|
|
)
|