|
@@ -2,11 +2,13 @@
|
|
|
@author: luojunhui
|
|
|
"""
|
|
|
import json
|
|
|
+import time
|
|
|
import asyncio
|
|
|
|
|
|
from applications.config import Config
|
|
|
from applications.log import logging
|
|
|
from applications.functions.pqFunctions import publishToPQ
|
|
|
+from applications.functions.common import shuffleList
|
|
|
|
|
|
|
|
|
class historyContentIdTask(object):
|
|
@@ -23,6 +25,7 @@ class historyContentIdTask(object):
|
|
|
self.article_video = Config().articleVideos
|
|
|
self.article_crawler_video = Config().articleCrawlerVideos
|
|
|
self.history_coroutines = Config().getConfigValue("historyArticleCoroutines")
|
|
|
+ self.gh_id_dict = json.loads(Config().getConfigValue("testAccountLevel2"))
|
|
|
|
|
|
async def getTaskList(self):
|
|
|
"""
|
|
@@ -115,20 +118,25 @@ class historyContentIdTask(object):
|
|
|
:param flow_pool_level: 流量池层级 ---> str
|
|
|
:return:
|
|
|
"""
|
|
|
- video_list = download_videos[:3]
|
|
|
+ # video_list = download_videos[:3]
|
|
|
match flow_pool_level:
|
|
|
case "autoArticlePoolLevel4":
|
|
|
- print("冷启层")
|
|
|
- video_list = []
|
|
|
+ # 冷启层, 全量做
|
|
|
+ video_list = shuffleList(download_videos)[:3]
|
|
|
case "autoArticlePoolLevel3":
|
|
|
- print("暂时未知层")
|
|
|
- video_list = []
|
|
|
+ # 次条,只针对具体账号做
|
|
|
+ if self.gh_id_dict.get(gh_id):
|
|
|
+ video_list = shuffleList(download_videos)[:3]
|
|
|
+ else:
|
|
|
+ video_list = download_videos[:3]
|
|
|
case "autoArticlePoolLevel2":
|
|
|
- print("次条层")
|
|
|
video_list = []
|
|
|
case "autoArticlePoolLevel1":
|
|
|
- print("头条层")
|
|
|
- video_list = []
|
|
|
+ # 头条,先不做
|
|
|
+ video_list = download_videos[:3]
|
|
|
+ case _:
|
|
|
+ print("未传流量池信息")
|
|
|
+ video_list = download_videos[:3]
|
|
|
L = []
|
|
|
for video_obj in video_list:
|
|
|
params = {
|
|
@@ -137,7 +145,7 @@ class historyContentIdTask(object):
|
|
|
"title": kimi_title
|
|
|
}
|
|
|
response = await publishToPQ(params)
|
|
|
- # time.sleep(2)
|
|
|
+ time.sleep(2)
|
|
|
obj = {
|
|
|
"uid": video_obj['uid'],
|
|
|
"source": video_obj['platform'],
|
|
@@ -171,7 +179,7 @@ class historyContentIdTask(object):
|
|
|
"""
|
|
|
content_id = params['content_id']
|
|
|
trace_id = params['trace_id']
|
|
|
- flow_pool_level = params['flow_pool_level'],
|
|
|
+ flow_pool_level = params['flow_pool_level']
|
|
|
gh_id = params['gh_id']
|
|
|
process_times = params['process_times']
|
|
|
# 判断该篇文章是否存在未下架的视频,且判断是否有3条, 如果没有三条,则启动新抓取任务,后续优化点
|