|
@@ -163,10 +163,6 @@ class VideoProcessor:
|
|
|
video_url = video["video_url"]
|
|
|
old_title = video['old_title']
|
|
|
rule = video['rule']
|
|
|
- # if channel_id == "单点视频":
|
|
|
- # redis_video = get_redis_video_data(v_id)
|
|
|
- # if redis_video:
|
|
|
- # continue
|
|
|
if not old_title:
|
|
|
old_title = '这个视频,分享给我的老友,祝愿您能幸福安康'
|
|
|
text = (
|
|
@@ -185,7 +181,7 @@ class VideoProcessor:
|
|
|
Common.logger(mark).info(f"{name}的{task_mark}下的ID{url} 开始下载视频")
|
|
|
new_video_path = cls.download_and_process_video(channel_id, video_url, video_path_url, v_id,
|
|
|
crop_total, gg_duration_total, pw_random_id, new_title, mark, video)
|
|
|
- if not os.path.isfile(new_video_path) or new_video_path == None:
|
|
|
+ if not os.path.isfile(new_video_path) or os.path.getsize(new_video_path) == 0:
|
|
|
AliyunLogger.logging(channel_id, name, url, v_id, "视频下载失败", "3002", f"video_url:{video_url}")
|
|
|
text = (
|
|
|
f"**通知类型**: 视频下载失败\n"
|
|
@@ -198,67 +194,15 @@ class VideoProcessor:
|
|
|
"https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
|
|
|
"【 机器改造通知 】")
|
|
|
continue
|
|
|
- if new_video_path:
|
|
|
- if video_ending and video_ending != 'None':
|
|
|
- new_video_path = cls.handle_video_ending(new_video_path, video_ending, old_title, pw_random_id, video_path_url, mark, task_mark, url, name, video_share, zm, voice)
|
|
|
- if new_video_path == None:
|
|
|
- if name == "单点视频":
|
|
|
- sqlCollect.update_shp_dd_vid_4(v_id)
|
|
|
- from_user_name = video['from_user_name'] # 来源用户
|
|
|
- from_group_name = video['from_group_name'] # 来源群组
|
|
|
- source = video['source'] # 渠道
|
|
|
- text = (
|
|
|
- f"**渠道**: {source}\n"
|
|
|
- f"**来源用户**: {from_user_name}\n"
|
|
|
- f"**来源群组**: {from_group_name}\n"
|
|
|
- f"**原视频链接**: {video['video_url']}\n"
|
|
|
- f"**原视频封面**: {video['cover']}\n"
|
|
|
- f"**原视频标题**: {video['old_title']}\n"
|
|
|
- )
|
|
|
- AliyunLogger.logging(channel_id, name, url, v_id, "视频下载失败", "3002")
|
|
|
- Feishu.finish_bot(text,
|
|
|
- "https://open.feishu.cn/open-apis/bot/v2/hook/493b3d4c-5fae-4a9d-980b-1dd86636524e",
|
|
|
- "【 视频下载失败,跳过该视频 】")
|
|
|
- if name == "快手推荐流" or name == "视频号推荐流":
|
|
|
- sqlCollect.update_feed_vid_2(v_id)
|
|
|
- Feishu.finish_bot(text,
|
|
|
- "https://open.feishu.cn/open-apis/bot/v2/hook/493b3d4c-5fae-4a9d-980b-1dd86636524e",
|
|
|
- "【 视频下载失败,跳过该视频 】")
|
|
|
- continue
|
|
|
- else:
|
|
|
- if video_share and video_share != 'None':
|
|
|
- new_video_path = FFmpeg.single_video(new_video_path, video_path_url, zm)
|
|
|
- # new_video_path = FFmpeg.single_video(new_video_path, video_path_url, zm)
|
|
|
-
|
|
|
- if not os.path.isfile(new_video_path):
|
|
|
- # log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title}"
|
|
|
- AliyunLogger.logging(channel_id, name, url, v_id, "视频改造失败", "3001")
|
|
|
- text = (
|
|
|
- f"**通知类型**: 视频改造失败\n"
|
|
|
- f"**负责人**: {name}\n"
|
|
|
- f"**渠道**: {channel_id}\n"
|
|
|
- f"**视频主页ID**: {url}\n"
|
|
|
- f"**视频Video_id**: {v_id}\n"
|
|
|
- )
|
|
|
- Feishu.finish_bot(text,
|
|
|
- "https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
|
|
|
- "【 机器改造通知 】")
|
|
|
- continue
|
|
|
- # 上传视频和封面,并更新数据库
|
|
|
- code = cls.upload_video_and_thumbnail(new_video_path, cover, v_id, new_title, task_mark, name, piaoquan_id,
|
|
|
- video_path_url, mark, channel_id, url, old_title, title, rule, video)
|
|
|
- # 更新已使用的视频号状态
|
|
|
- pq_url = f'https://admin.piaoquantv.com/cms/post-detail/{code}/detail' # 站内视频链接
|
|
|
- if name == "单点视频":
|
|
|
- sphdd_status = sqlCollect.update_shp_dd_vid(v_id)
|
|
|
- if sphdd_status == 1:
|
|
|
- Common.logger(mark).info(f"{name}的{task_mark}下的ID{url} 视频修改已使用,状态已修改")
|
|
|
+ if video_ending and video_ending != 'None':
|
|
|
+ new_video_path = cls.handle_video_ending(new_video_path, video_ending, old_title, pw_random_id, video_path_url, mark, task_mark, url, name, video_share, zm, voice)
|
|
|
+ if new_video_path == None:
|
|
|
+ if name == "单点视频":
|
|
|
+ sqlCollect.update_shp_dd_vid_4(v_id)
|
|
|
from_user_name = video['from_user_name'] # 来源用户
|
|
|
from_group_name = video['from_group_name'] # 来源群组
|
|
|
source = video['source'] # 渠道
|
|
|
- channel_id = source
|
|
|
text = (
|
|
|
- f"**站内视频链接**: {pq_url}\n"
|
|
|
f"**渠道**: {source}\n"
|
|
|
f"**来源用户**: {from_user_name}\n"
|
|
|
f"**来源群组**: {from_group_name}\n"
|
|
@@ -266,167 +210,215 @@ class VideoProcessor:
|
|
|
f"**原视频封面**: {video['cover']}\n"
|
|
|
f"**原视频标题**: {video['old_title']}\n"
|
|
|
)
|
|
|
- Feishu.finish_bot(text, "https://open.feishu.cn/open-apis/bot/v2/hook/d2f751a8-5b0a-49ca-a306-1fda142707a9", "【 有一条新的内容改造成功 】")
|
|
|
- if name == "快手推荐流" or name == "视频号推荐流":
|
|
|
- feed_status = sqlCollect.update_feed_vid(v_id)
|
|
|
- if feed_status == 1:
|
|
|
- Common.logger(mark).info(f"{name}的{task_mark}下的ID{url} 视频修改已使用,状态已修改")
|
|
|
- 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")
|
|
|
- if name == "品类关键词搜索":
|
|
|
- first_category = task["first_category"]
|
|
|
- keyword_principal = task["keyword_name"]
|
|
|
- tag_first = f"一级品类_{first_category}"
|
|
|
- tag_keyword = f"关键词_{url}"
|
|
|
- if channel_id == "抖音搜索":
|
|
|
- tag_channel = "来源_抖音关键词"
|
|
|
- elif channel_id == "快手搜索":
|
|
|
- tag_channel = "来源_快手关键词"
|
|
|
- elif channel_id == "视频号搜索":
|
|
|
- tag_channel = "来源_视频号关键词"
|
|
|
- tag = f"{tag_first},{tag_keyword},{tag_channel}"
|
|
|
- tag_status = Tag.video_tag(code, tag)
|
|
|
- if tag_status == 0:
|
|
|
- Common.logger(mark).info(f"{name}的{task_mark}下的ID{url}下的票圈视频{code},写入标签成功")
|
|
|
- secondary_category = task["secondary_category"]
|
|
|
- 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},,tag:{tag}"
|
|
|
- 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
|
|
|
- ]
|
|
|
- ]
|
|
|
- elif name == "抖音品类账号-1" or name == "抖音品类账号" or name == "视频号品类账号" or name == "快手品类账号":
|
|
|
- first_category = task["first_category"]
|
|
|
- tag_first = f"一级品类_{first_category}"
|
|
|
- if channel_id == "抖音" or channel_id == "抖音历史":
|
|
|
- tag_channel = "来源_抖音品类账号"
|
|
|
- elif channel_id == "快手" or channel_id == "快手历史":
|
|
|
- tag_channel = "来源_快手品类账号"
|
|
|
- elif channel_id == "视频号" or channel_id == "视频号历史":
|
|
|
- tag_channel = "来源_视频号品类账号"
|
|
|
- tag = f"{tag_first},{tag_channel}"
|
|
|
- tag_status = Tag.video_tag( code, tag )
|
|
|
- if tag_status == 0:
|
|
|
- Common.logger(mark).info(f"{name}的{task_mark}下的ID{url}下的票圈视频{code},写入标签成功")
|
|
|
- log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice},,tag:{tag}"
|
|
|
- # log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice},,first_category:{first_category},,tag:{tag}"
|
|
|
- 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,
|
|
|
- pq_url
|
|
|
- ]
|
|
|
- ]
|
|
|
-
|
|
|
- else:
|
|
|
- log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice}"
|
|
|
- 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
|
|
|
- ]
|
|
|
- ]
|
|
|
- AliyunLogger.logging(channel_id, name, url, v_id, "视频改造成功", "1000", log_data, str(code))
|
|
|
+ AliyunLogger.logging(channel_id, name, url, v_id, "视频下载失败", "3002")
|
|
|
+ Feishu.finish_bot(text,
|
|
|
+ "https://open.feishu.cn/open-apis/bot/v2/hook/493b3d4c-5fae-4a9d-980b-1dd86636524e",
|
|
|
+ "【 视频下载失败,跳过该视频 】")
|
|
|
+ if name == "快手推荐流" or name == "视频号推荐流":
|
|
|
+ sqlCollect.update_feed_vid_2(v_id)
|
|
|
+ Feishu.finish_bot(text,
|
|
|
+ "https://open.feishu.cn/open-apis/bot/v2/hook/493b3d4c-5fae-4a9d-980b-1dd86636524e",
|
|
|
+ "【 视频下载失败,跳过该视频 】")
|
|
|
+ continue
|
|
|
+ else:
|
|
|
+ if video_share and video_share != 'None':
|
|
|
+ new_video_path = FFmpeg.single_video(new_video_path, video_path_url, zm)
|
|
|
+ if not os.path.isfile(new_video_path) or os.path.getsize(new_video_path) == 0:
|
|
|
+ AliyunLogger.logging(channel_id, name, url, v_id, "视频改造失败", "3001")
|
|
|
text = (
|
|
|
- f"**通知类型**: 视频改造成功\n"
|
|
|
- f"**站内视频链接**: {pq_url}\n"
|
|
|
+ f"**通知类型**: 视频改造失败\n"
|
|
|
f"**负责人**: {name}\n"
|
|
|
f"**渠道**: {channel_id}\n"
|
|
|
f"**视频主页ID**: {url}\n"
|
|
|
f"**视频Video_id**: {v_id}\n"
|
|
|
- f"**使用音频音色**: {voice}\n"
|
|
|
)
|
|
|
Feishu.finish_bot(text,
|
|
|
"https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
|
|
|
"【 机器改造通知 】")
|
|
|
- if tags:
|
|
|
- Tag.video_tag(code, tags)
|
|
|
- if values:
|
|
|
- if name == "王雪珂":
|
|
|
- sheet = "vfhHwj"
|
|
|
- elif name == "鲁涛":
|
|
|
- sheet = "FhewlS"
|
|
|
- elif name == "范军":
|
|
|
- sheet = "B6dCfS"
|
|
|
- elif name == "余海涛":
|
|
|
- sheet = "mfBrNT"
|
|
|
- elif name == "罗情":
|
|
|
- sheet = "2J3PwN"
|
|
|
- elif name == "王玉婷":
|
|
|
- sheet = "bBHFwC"
|
|
|
- elif name == "刘诗雨":
|
|
|
- sheet = "fBdxIQ"
|
|
|
- elif name == "信欣":
|
|
|
- sheet = "lPe1eT"
|
|
|
- elif name == "快手创作者版品类推荐流":
|
|
|
- sheet = "k7l7nQ"
|
|
|
- elif name == "抖音品类账号":
|
|
|
- sheet = "ZixHmf"
|
|
|
- elif name == "抖音品类账号-1":
|
|
|
- sheet = "61kvW7"
|
|
|
- elif name == "视频号品类账号":
|
|
|
- sheet = "b0uLWw"
|
|
|
- elif name == "单点视频":
|
|
|
- sheet = "ptgCXW"
|
|
|
- elif name == "快手品类账号":
|
|
|
- sheet = "ibjoMx"
|
|
|
- elif name == "品类关键词搜索":
|
|
|
- sheet = "rBAJT8"
|
|
|
- elif name == "快手推荐流":
|
|
|
- sheet = "9Ii8lw"
|
|
|
- elif name == "视频号推荐流":
|
|
|
- sheet = "hMBv7T"
|
|
|
- elif name == "快手小程序":
|
|
|
- sheet = "GeDT6Q"
|
|
|
- Feishu.insert_columns("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "ROWS", 1, 2)
|
|
|
- time.sleep(0.5)
|
|
|
- Feishu.update_values("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "A2:Z2", values)
|
|
|
+ continue
|
|
|
+ # 上传视频和封面,并更新数据库
|
|
|
+ code = cls.upload_video_and_thumbnail(new_video_path, cover, v_id, new_title, task_mark, name, piaoquan_id,
|
|
|
+ video_path_url, mark, channel_id, url, old_title, title, rule, video)
|
|
|
+ # 更新已使用的视频号状态
|
|
|
+ pq_url = f'https://admin.piaoquantv.com/cms/post-detail/{code}/detail' # 站内视频链接
|
|
|
+ if name == "单点视频":
|
|
|
+ sphdd_status = sqlCollect.update_shp_dd_vid(v_id)
|
|
|
+ if sphdd_status == 1:
|
|
|
+ Common.logger(mark).info(f"{name}的{task_mark}下的ID{url} 视频修改已使用,状态已修改")
|
|
|
+ from_user_name = video['from_user_name'] # 来源用户
|
|
|
+ from_group_name = video['from_group_name'] # 来源群组
|
|
|
+ source = video['source'] # 渠道
|
|
|
+ channel_id = source
|
|
|
+ text = (
|
|
|
+ f"**站内视频链接**: {pq_url}\n"
|
|
|
+ f"**渠道**: {source}\n"
|
|
|
+ f"**来源用户**: {from_user_name}\n"
|
|
|
+ f"**来源群组**: {from_group_name}\n"
|
|
|
+ f"**原视频链接**: {video['video_url']}\n"
|
|
|
+ f"**原视频封面**: {video['cover']}\n"
|
|
|
+ f"**原视频标题**: {video['old_title']}\n"
|
|
|
+ )
|
|
|
+ Feishu.finish_bot(text, "https://open.feishu.cn/open-apis/bot/v2/hook/d2f751a8-5b0a-49ca-a306-1fda142707a9", "【 有一条新的内容改造成功 】")
|
|
|
+ if name == "快手推荐流" or name == "视频号推荐流":
|
|
|
+ feed_status = sqlCollect.update_feed_vid(v_id)
|
|
|
+ if feed_status == 1:
|
|
|
+ Common.logger(mark).info(f"{name}的{task_mark}下的ID{url} 视频修改已使用,状态已修改")
|
|
|
+ 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")
|
|
|
+ if name == "品类关键词搜索":
|
|
|
+ first_category = task["first_category"]
|
|
|
+ keyword_principal = task["keyword_name"]
|
|
|
+ tag_first = f"一级品类_{first_category}"
|
|
|
+ tag_keyword = f"关键词_{url}"
|
|
|
+ if channel_id == "抖音搜索":
|
|
|
+ tag_channel = "来源_抖音关键词"
|
|
|
+ elif channel_id == "快手搜索":
|
|
|
+ tag_channel = "来源_快手关键词"
|
|
|
+ elif channel_id == "视频号搜索":
|
|
|
+ tag_channel = "来源_视频号关键词"
|
|
|
+ tag = f"{tag_first},{tag_keyword},{tag_channel}"
|
|
|
+ tag_status = Tag.video_tag(code, tag)
|
|
|
+ if tag_status == 0:
|
|
|
+ Common.logger(mark).info(f"{name}的{task_mark}下的ID{url}下的票圈视频{code},写入标签成功")
|
|
|
+ secondary_category = task["secondary_category"]
|
|
|
+ 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},,tag:{tag}"
|
|
|
+ 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
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ elif name == "抖音品类账号-1" or name == "抖音品类账号" or name == "视频号品类账号" or name == "快手品类账号":
|
|
|
+ first_category = task["first_category"]
|
|
|
+ tag_first = f"一级品类_{first_category}"
|
|
|
+ if channel_id == "抖音" or channel_id == "抖音历史":
|
|
|
+ tag_channel = "来源_抖音品类账号"
|
|
|
+ elif channel_id == "快手" or channel_id == "快手历史":
|
|
|
+ tag_channel = "来源_快手品类账号"
|
|
|
+ elif channel_id == "视频号" or channel_id == "视频号历史":
|
|
|
+ tag_channel = "来源_视频号品类账号"
|
|
|
+ tag = f"{tag_first},{tag_channel}"
|
|
|
+ tag_status = Tag.video_tag( code, tag )
|
|
|
+ if tag_status == 0:
|
|
|
+ Common.logger(mark).info(f"{name}的{task_mark}下的ID{url}下的票圈视频{code},写入标签成功")
|
|
|
+ log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice},,tag:{tag}"
|
|
|
+ # log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice},,first_category:{first_category},,tag:{tag}"
|
|
|
+ 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,
|
|
|
+ pq_url
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+
|
|
|
+ else:
|
|
|
+ log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice}"
|
|
|
+ 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
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ AliyunLogger.logging(channel_id, name, url, v_id, "视频改造成功", "1000", log_data, str(code))
|
|
|
+ text = (
|
|
|
+ f"**通知类型**: 视频改造成功\n"
|
|
|
+ f"**站内视频链接**: {pq_url}\n"
|
|
|
+ f"**负责人**: {name}\n"
|
|
|
+ f"**渠道**: {channel_id}\n"
|
|
|
+ f"**视频主页ID**: {url}\n"
|
|
|
+ f"**视频Video_id**: {v_id}\n"
|
|
|
+ f"**使用音频音色**: {voice}\n"
|
|
|
+ )
|
|
|
+ Feishu.finish_bot(text,
|
|
|
+ "https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
|
|
|
+ "【 机器改造通知 】")
|
|
|
+ if tags:
|
|
|
+ Tag.video_tag(code, tags)
|
|
|
+ if values:
|
|
|
+ if name == "王雪珂":
|
|
|
+ sheet = "vfhHwj"
|
|
|
+ elif name == "鲁涛":
|
|
|
+ sheet = "FhewlS"
|
|
|
+ elif name == "范军":
|
|
|
+ sheet = "B6dCfS"
|
|
|
+ elif name == "余海涛":
|
|
|
+ sheet = "mfBrNT"
|
|
|
+ elif name == "罗情":
|
|
|
+ sheet = "2J3PwN"
|
|
|
+ elif name == "王玉婷":
|
|
|
+ sheet = "bBHFwC"
|
|
|
+ elif name == "刘诗雨":
|
|
|
+ sheet = "fBdxIQ"
|
|
|
+ elif name == "信欣":
|
|
|
+ sheet = "lPe1eT"
|
|
|
+ elif name == "快手创作者版品类推荐流":
|
|
|
+ sheet = "k7l7nQ"
|
|
|
+ elif name == "抖音品类账号":
|
|
|
+ sheet = "ZixHmf"
|
|
|
+ elif name == "抖音品类账号-1":
|
|
|
+ sheet = "61kvW7"
|
|
|
+ elif name == "视频号品类账号":
|
|
|
+ sheet = "b0uLWw"
|
|
|
+ elif name == "单点视频":
|
|
|
+ sheet = "ptgCXW"
|
|
|
+ elif name == "快手品类账号":
|
|
|
+ sheet = "ibjoMx"
|
|
|
+ elif name == "品类关键词搜索":
|
|
|
+ sheet = "rBAJT8"
|
|
|
+ elif name == "快手推荐流":
|
|
|
+ sheet = "9Ii8lw"
|
|
|
+ elif name == "视频号推荐流":
|
|
|
+ sheet = "hMBv7T"
|
|
|
+ elif name == "快手小程序":
|
|
|
+ sheet = "GeDT6Q"
|
|
|
+ Feishu.insert_columns("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "ROWS", 1, 2)
|
|
|
+ time.sleep(0.5)
|
|
|
+ Feishu.update_values("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "A2:Z2", values)
|
|
|
except Exception as e:
|
|
|
AliyunLogger.logging(channel_id, name, url, video["video_id"], f"改造失败{e}", "3001", log_data)
|
|
|
Common.logger(mark).error(f"{name}的{task_mark}任务处理失败:{e}")
|
|
@@ -508,43 +500,38 @@ class VideoProcessor:
|
|
|
"""
|
|
|
if channel_id == "单点视频":
|
|
|
new_video_path = PQ.dd_sph_download_video(video_url, video_path_url, v_id, video, channel_id)
|
|
|
- if new_video_path == None:
|
|
|
- return None
|
|
|
- Common.logger(mark).info(f"{channel_id}视频下载成功: {new_video_path}")
|
|
|
- elif channel_id == "视频号":
|
|
|
- new_video_path = PQ.sph_download_video(video_url, video_path_url, v_id, video)
|
|
|
- if new_video_path == None:
|
|
|
- return None
|
|
|
- Common.logger(mark).info(f"{channel_id}视频下载成功: {new_video_path}")
|
|
|
- elif channel_id == "票圈" or channel_id == "快手创作者版" or channel_id == '视频号搜索':
|
|
|
- new_video_path = PQ.download_video(video_url, video_path_url, v_id)
|
|
|
- if new_video_path == None:
|
|
|
- return None
|
|
|
- Common.logger(mark).info(f"{channel_id}视频下载成功: {new_video_path}")
|
|
|
+ # elif channel_id == "视频号":
|
|
|
+ # new_video_path = PQ.sph_download_video(video_url, video_path_url, v_id, video)
|
|
|
+ # if new_video_path == None:
|
|
|
+ # return None
|
|
|
+ # Common.logger(mark).info(f"{channel_id}视频下载成功: {new_video_path}")
|
|
|
+ # elif channel_id == "票圈" or channel_id == "快手创作者版" or channel_id == '视频号搜索':
|
|
|
+ # new_video_path = PQ.download_video(video_url, video_path_url, v_id)
|
|
|
+ # if new_video_path == None:
|
|
|
+ # return None
|
|
|
+ # Common.logger(mark).info(f"{channel_id}视频下载成功: {new_video_path}")
|
|
|
elif channel_id == "视频号历史":
|
|
|
new_video_path = Oss.download_sph_ls(video_url, video_path_url, v_id)
|
|
|
- Common.logger(mark).info(f"{channel_id}视频下载成功: {new_video_path}")
|
|
|
else:
|
|
|
Common.logger(mark).info(f"视频准备下载")
|
|
|
new_video_path = Oss.download_video_oss(video_url, video_path_url, v_id)
|
|
|
- Common.logger(mark).info(f"视频下载成功: {new_video_path}")
|
|
|
- if os.path.isfile(new_video_path):
|
|
|
- if crop_total and crop_total != 'None': # 判断是否需要裁剪
|
|
|
- new_video_path = FFmpeg.video_crop(new_video_path, video_path_url, pw_random_id)
|
|
|
- if gg_duration_total and gg_duration_total != 'None': # 判断是否需要指定视频时长
|
|
|
- new_video_path = FFmpeg.video_ggduration(new_video_path, video_path_url, pw_random_id,
|
|
|
- gg_duration_total)
|
|
|
- width, height = FFmpeg.get_w_h_size(new_video_path)
|
|
|
- if width < height: # 判断是否需要修改为竖屏
|
|
|
- new_video_path = FFmpeg.update_video_h_w(new_video_path, video_path_url, pw_random_id)
|
|
|
- new_title_re = re.sub(r'[^\w\s\u4e00-\u9fff,。!?]', '', new_title)
|
|
|
- if len(new_title_re) > 12:
|
|
|
- new_title_re = '\n'.join(
|
|
|
- [new_title_re[i:i + 12] for i in range(0, len(new_title_re), 12)])
|
|
|
- new_video_path = FFmpeg.add_video_zm(new_video_path, video_path_url, pw_random_id, new_title_re)
|
|
|
- return new_video_path
|
|
|
- else:
|
|
|
+ if not os.path.isfile(new_video_path) or os.path.getsize(new_video_path) == 0:
|
|
|
return None
|
|
|
+ Common.logger(mark).info(f"视频下载成功: {new_video_path}")
|
|
|
+ if crop_total and crop_total != 'None': # 判断是否需要裁剪
|
|
|
+ new_video_path = FFmpeg.video_crop(new_video_path, video_path_url, pw_random_id)
|
|
|
+ if gg_duration_total and gg_duration_total != 'None': # 判断是否需要指定视频时长
|
|
|
+ new_video_path = FFmpeg.video_ggduration(new_video_path, video_path_url, pw_random_id,
|
|
|
+ gg_duration_total)
|
|
|
+ width, height = FFmpeg.get_w_h_size(new_video_path)
|
|
|
+ if width < height: # 判断是否需要修改为竖屏
|
|
|
+ new_video_path = FFmpeg.update_video_h_w(new_video_path, video_path_url, pw_random_id)
|
|
|
+ new_title_re = re.sub(r'[^\w\s\u4e00-\u9fff,。!?]', '', new_title)
|
|
|
+ if len(new_title_re) > 12:
|
|
|
+ new_title_re = '\n'.join(
|
|
|
+ [new_title_re[i:i + 12] for i in range(0, len(new_title_re), 12)])
|
|
|
+ new_video_path = FFmpeg.add_video_zm(new_video_path, video_path_url, pw_random_id, new_title_re)
|
|
|
+ return new_video_path
|
|
|
|
|
|
@classmethod
|
|
|
def handle_video_ending(cls, new_video_path, video_ending, old_title, pw_random_id, video_path_url, mark, task_mark, url, name, video_share, zm, voice):
|
|
@@ -603,7 +590,7 @@ class VideoProcessor:
|
|
|
pw_video_list = [new_video_path, pw_path]
|
|
|
Common.logger(mark).info(f"{task_mark}下的视频{url},视频与片尾开始拼接")
|
|
|
video_path = FFmpeg.concatenate_videos(pw_video_list, video_path_url) # 视频与片尾拼接到一起
|
|
|
- if video_path:
|
|
|
+ if os.path.exists(video_path) or os.path.getsize(video_path) != 0:
|
|
|
Common.logger(mark).info(f"{name}的{task_mark}下的视频{url},视频与片尾拼接成功")
|
|
|
time.sleep(1)
|
|
|
if video_share and video_share != 'None':
|
|
@@ -612,7 +599,7 @@ class VideoProcessor:
|
|
|
new_video_path = video_path
|
|
|
return new_video_path
|
|
|
else:
|
|
|
- return None
|
|
|
+ return new_video_path
|
|
|
|
|
|
|
|
|
|