|
@@ -3,18 +3,16 @@ import json
|
|
|
import os
|
|
|
import random
|
|
|
import re
|
|
|
-import sys
|
|
|
-import threading
|
|
|
import time
|
|
|
from datetime import datetime
|
|
|
-import concurrent.futures
|
|
|
|
|
|
-from common.redis import get_data, get_redis_video_data
|
|
|
+from common.redis import get_data, get_first_value_with_prefix, increment_key
|
|
|
from common.tts_help import TTS
|
|
|
from common import Material, Feishu, Common, Oss, AliyunLogger
|
|
|
from common.ffmpeg import FFmpeg
|
|
|
from common.gpt4o_help import GPT4o
|
|
|
from data_channel.douyin import DY
|
|
|
+from data_channel.dy_keyword import DyKeyword
|
|
|
from data_channel.dy_ls import DYLS
|
|
|
from data_channel.ks_ls import KSLS
|
|
|
from data_channel.kuaishou import KS
|
|
@@ -97,7 +95,7 @@ class VideoProcessor:
|
|
|
video_path_url = cls.create_folders(mark, str(task_mark))
|
|
|
zm = Material.get_pzsrt_data("summary", "500Oe0", video_share)
|
|
|
Common.logger(mark).info(f"{name}的{task_mark}下{channel_id}的用户:{url}开始获取视频")
|
|
|
- data_list = cls.get_data_list(channel_id, task_mark, url, number, mark, feishu_id, cookie_sheet, name)
|
|
|
+ data_list = cls.get_data_list(channel_id, task_mark, url, number, mark, feishu_id, cookie_sheet, name, task)
|
|
|
if not data_list:
|
|
|
AliyunLogger.logging(channel_id, name, url, "", "无改造视频", "4000")
|
|
|
Common.logger(mark).info(f"{name}的{task_mark}下{channel_id}的视频ID{url} 已经改造过了")
|
|
@@ -219,32 +217,62 @@ class VideoProcessor:
|
|
|
Feishu.finish_bot(text,
|
|
|
"https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
|
|
|
"【 机器改造通知 】")
|
|
|
- log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice}"
|
|
|
- AliyunLogger.logging(channel_id, name, url, v_id, "视频改造成功", "1000", log_data, str(code))
|
|
|
if channel_id == "快手历史" or channel_id == "抖音历史" or channel_id == "视频号历史":
|
|
|
explain = "历史爆款"
|
|
|
else:
|
|
|
explain = "新供给"
|
|
|
current_time = datetime.now()
|
|
|
formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
|
|
|
- values = [
|
|
|
- [
|
|
|
- name,
|
|
|
- task_mark,
|
|
|
- channel_id,
|
|
|
- url,
|
|
|
- str(v_id),
|
|
|
- piaoquan_id,
|
|
|
- old_title,
|
|
|
- title if title in ["原标题", "AI标题"] else "",
|
|
|
- new_title,
|
|
|
- str(code),
|
|
|
- formatted_time,
|
|
|
- str(rule),
|
|
|
- explain,
|
|
|
- voice
|
|
|
+ if name == "品类关键词搜索":
|
|
|
+ first_category = task["first_category"]
|
|
|
+ secondary_category = task["secondary_category"]
|
|
|
+ keyword_principal = task["keyword_name"]
|
|
|
+ log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice},,first_category:{first_category},,secondary_category:{secondary_category},,keyword_principal:{keyword_principal}"
|
|
|
+ AliyunLogger.logging(channel_id, name, url, v_id, "视频改造成功", "1000", log_data, str(code))
|
|
|
+ values = [
|
|
|
+ [
|
|
|
+ name,
|
|
|
+ task_mark,
|
|
|
+ channel_id,
|
|
|
+ url,
|
|
|
+ str(v_id),
|
|
|
+ piaoquan_id,
|
|
|
+ old_title,
|
|
|
+ title if title in ["原标题", "AI标题"] else "",
|
|
|
+ new_title,
|
|
|
+ str(code),
|
|
|
+ formatted_time,
|
|
|
+ str(rule),
|
|
|
+ explain,
|
|
|
+ voice,
|
|
|
+ first_category,
|
|
|
+ secondary_category,
|
|
|
+ keyword_principal,
|
|
|
+ pq_url
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ else:
|
|
|
+ log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice}"
|
|
|
+ AliyunLogger.logging(channel_id, name, url, v_id, "视频改造成功", "1000", log_data, str(code))
|
|
|
+
|
|
|
+ values = [
|
|
|
+ [
|
|
|
+ name,
|
|
|
+ task_mark,
|
|
|
+ channel_id,
|
|
|
+ url,
|
|
|
+ str(v_id),
|
|
|
+ piaoquan_id,
|
|
|
+ old_title,
|
|
|
+ title if title in ["原标题", "AI标题"] else "",
|
|
|
+ new_title,
|
|
|
+ str(code),
|
|
|
+ formatted_time,
|
|
|
+ str(rule),
|
|
|
+ explain,
|
|
|
+ voice
|
|
|
+ ]
|
|
|
]
|
|
|
- ]
|
|
|
if values:
|
|
|
if name == "王雪珂":
|
|
|
sheet = "vfhHwj"
|
|
@@ -274,6 +302,8 @@ class VideoProcessor:
|
|
|
sheet = "ptgCXW"
|
|
|
elif name == "快手品类账号":
|
|
|
sheet = "ibjoMx"
|
|
|
+ elif name == "品类关键词搜索":
|
|
|
+ sheet = "Tgpikc"
|
|
|
Feishu.insert_columns("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "ROWS", 1, 2)
|
|
|
time.sleep(0.5)
|
|
|
Feishu.update_values("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "A2:Z2", values)
|
|
@@ -284,7 +314,7 @@ class VideoProcessor:
|
|
|
continue
|
|
|
|
|
|
@classmethod
|
|
|
- def get_data_list(cls, channel_id, task_mark, url, number, mark, feishu_id, cookie_sheet, name):
|
|
|
+ def get_data_list(cls, channel_id, task_mark, url, number, mark, feishu_id, cookie_sheet, name, task):
|
|
|
"""
|
|
|
根据渠道ID获取数据列表
|
|
|
"""
|
|
@@ -306,6 +336,8 @@ class VideoProcessor:
|
|
|
return KSLS.get_ksls_list(task_mark, url, number, mark, channel_id, name)
|
|
|
elif channel_id == "视频号历史":
|
|
|
return SPHLS.get_sphls_data(task_mark, url, number, mark, channel_id, name)
|
|
|
+ elif channel_id == '抖音搜索':
|
|
|
+ return DyKeyword.get_key_word(url, task_mark, mark, channel_id, name, task)
|
|
|
|
|
|
@classmethod
|
|
|
def generate_title(cls, video, title):
|
|
@@ -499,13 +531,22 @@ class VideoProcessor:
|
|
|
feishu_id = data["feishu_id"]
|
|
|
feishu_sheet = data["feishu_sheet"]
|
|
|
cookie_sheet = data["cookie_sheet"]
|
|
|
- task_data = Material.get_task_data(feishu_id, feishu_sheet)
|
|
|
+ if mark == 'pl-gjc':
|
|
|
+ task_data = Material.get_keyword_data(feishu_id, feishu_sheet)
|
|
|
+ else:
|
|
|
+ task_data = Material.get_task_data(feishu_id, feishu_sheet)
|
|
|
try:
|
|
|
data = get_data(mark, task_data)
|
|
|
if not data:
|
|
|
Common.logger("redis").error(f"{mark}任务开始新的一轮\n")
|
|
|
return
|
|
|
task = json.loads(data)
|
|
|
+ if mark == 'pl-gjc' and task['channel_id'] == '抖音搜索':
|
|
|
+ count = get_first_value_with_prefix()
|
|
|
+ increment_key()
|
|
|
+ if int(count) == 100:
|
|
|
+ Common.logger(mark).log(f"抖音搜索接口今日已经上限")
|
|
|
+ return "抖音搜索上限"
|
|
|
VideoProcessor.process_task(task, mark, name, feishu_id, cookie_sheet)
|
|
|
return mark
|
|
|
except Exception as e:
|