|
@@ -7,6 +7,7 @@ import uuid
|
|
import requests
|
|
import requests
|
|
|
|
|
|
from common.mq import MQ
|
|
from common.mq import MQ
|
|
|
|
+from common.redis_db import SyncRedisHelper
|
|
|
|
|
|
sys.path.append(os.getcwd())
|
|
sys.path.append(os.getcwd())
|
|
|
|
|
|
@@ -194,6 +195,7 @@ class XiaoNianGaoAuthor:
|
|
)
|
|
)
|
|
|
|
|
|
def process_video_obj(self, video_obj, user_dict):
|
|
def process_video_obj(self, video_obj, user_dict):
|
|
|
|
+ sp = SyncRedisHelper()
|
|
trace_id = self.platform + str(uuid.uuid1())
|
|
trace_id = self.platform + str(uuid.uuid1())
|
|
# 标题,表情随机加在片头、片尾,或替代句子中间的标点符号
|
|
# 标题,表情随机加在片头、片尾,或替代句子中间的标点符号
|
|
xiaoniangao_title = clean_title(video_obj.get("title", ""))
|
|
xiaoniangao_title = clean_title(video_obj.get("title", ""))
|
|
@@ -247,6 +249,19 @@ class XiaoNianGaoAuthor:
|
|
"strategy": self.mode,
|
|
"strategy": self.mode,
|
|
"out_video_id": video_obj.get("vid", ""),
|
|
"out_video_id": video_obj.get("vid", ""),
|
|
}
|
|
}
|
|
|
|
+ # 判断redis中是否有该条内容
|
|
|
|
+ value = sp.get_data(self.platform, video_obj.get("vid", ""))
|
|
|
|
+ if value:
|
|
|
|
+ AliyunLogger.logging(
|
|
|
|
+ code="2004",
|
|
|
|
+ trace_id=trace_id,
|
|
|
|
+ platform=self.platform,
|
|
|
|
+ mode=self.mode,
|
|
|
|
+ env=self.env,
|
|
|
|
+ data=video_dict,
|
|
|
|
+ message="redis重复视频:{}".format(video_dict),
|
|
|
|
+ )
|
|
|
|
+ return False
|
|
pipeline = PiaoQuanPipeline(
|
|
pipeline = PiaoQuanPipeline(
|
|
platform=self.platform,
|
|
platform=self.platform,
|
|
mode=self.mode,
|
|
mode=self.mode,
|
|
@@ -300,6 +315,8 @@ class XiaoNianGaoAuthor:
|
|
limit_flag = self.limiter.author_limitation(user_id=video_dict['user_id'])
|
|
limit_flag = self.limiter.author_limitation(user_id=video_dict['user_id'])
|
|
if limit_flag:
|
|
if limit_flag:
|
|
self.mq.send_msg(video_dict)
|
|
self.mq.send_msg(video_dict)
|
|
|
|
+ # 将渠道+视频id写入 redis 中
|
|
|
|
+ sp.store_data(self.platform, video_obj.get("vid", ""))
|
|
self.download_count += 1
|
|
self.download_count += 1
|
|
AliyunLogger.logging(
|
|
AliyunLogger.logging(
|
|
code="1002",
|
|
code="1002",
|