zhangyong 2 months ago
parent
commit
5d78f717a6
3 changed files with 9 additions and 6 deletions
  1. 1 1
      carry_video/carry_video.py
  2. 5 4
      carry_video/nrfx_carry_video.py
  3. 3 1
      data_channel/piaoquan.py

+ 1 - 1
carry_video/carry_video.py

@@ -129,7 +129,7 @@ class CarryViode:
             n_id_list = [n_ids]
         pq_list = []
         for n_id in n_id_list:
-            code = PQ.insert_piaoquantv(oss_object_key, title, n_id)
+            code = PQ.insert_piaoquantv(oss_object_key, title, n_id, None)
             if not code:
                 logger.error(f"[+] {REDIS_NAME}的{data}写入票圈后台失败")
                 AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"],

+ 5 - 4
carry_video/nrfx_carry_video.py

@@ -125,7 +125,7 @@ class NrfxCarryViode:
         logger.info(f"[+] 开始写入票圈")
 
 
-        code = PQ.insert_piaoquantv(oss_object_key, title, '50322062')
+        code = PQ.insert_piaoquantv(oss_object_key, title, '50322062', cover)
         if not code:
             logger.error(f"[+] 写入票圈后台失败")
             text = (
@@ -146,11 +146,11 @@ class NrfxCarryViode:
         try:
             current_time = datetime.now()
             formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
-            sqlCollect.insert_machine_making_data(data["channel"], data["name"], data["name"],
+            sqlCollect.insert_machine_making_data(data["channel"], data["channel"], data["channel"],
                                                   data["videoid"], data["videoid"], "50322062",
                                                   title,
                                                   code,
-                                                  formatted_time, data["title_category"], oss_object_key)
+                                                  formatted_time, title, oss_object_key)
             pq_url = f'https://admin.piaoquantv.com/cms/post-detail/{code}/detail'  # 站内视频链接
             values = [
                 [
@@ -211,6 +211,7 @@ class NrfxCarryViode:
             return
         logger.info(f"[+] {video_url}视频下载成功")
         logger.info(f"[+] {video_url}开始处理标题")
+        video_path = FFmpeg.video_640(video_path, file_path)
         logger.info(f"[+] 视频更改分辨率处理成功")
         logger.info(f"[+] 内容分析-开始获取视频口播内容")
         video_text = GoogleAI.run(GEMINI_API_KEY, video_path)
@@ -281,7 +282,7 @@ class NrfxCarryViode:
         pw_path = FFmpeg.pw_video(jpg_path, file_path, pw_mp3_path, pw_srt)  # 生成片尾视频
         if not os.path.exists(pw_path) or os.path.getsize(pw_path) == 0:
             logger.error(f"[+] 内容分析-片尾拼接失败")
-            AliyunLogger.logging(data["name"], "内容分析", "", data["video_url"],
+            AliyunLogger.logging(data["type"], "内容分析", "", data["video_url"],
                                  "内容分析,片尾拼接失败", "3003", str(data))
             text = (
                 f"**渠道**: {data['channel']}\n"

+ 3 - 1
data_channel/piaoquan.py

@@ -12,7 +12,7 @@ class PQ:
     新生成视频上传到对应账号下
     """
     @classmethod
-    def insert_piaoquantv(cls, new_video_path, new_title, n_id):
+    def insert_piaoquantv(cls, new_video_path, new_title, n_id, cover):
         url = "https://vlogapi.piaoquantv.com/longvideoapi/crawler/video/send?muid=999"
         headers = {
             'User-Agent': 'PQSpeed/486 CFNetwork/1410.1 Darwin/22.6.0',
@@ -40,6 +40,8 @@ class PQ:
             'videoPath': new_video_path,
             'viewStatus': '1'
         }
+        if cover:
+            payload['coverImgPath'] = cover
         encoded_payload = urlencode(payload)
         response = requests.request("POST", url, headers=headers, data=encoded_payload, timeout=10)
         data = response.json()