zhangyong 4 mesi fa
parent
commit
62e65116c5
1 ha cambiato i file con 14 aggiunte e 11 eliminazioni
  1. 14 11
      carry_video/carry_video.py

+ 14 - 11
carry_video/carry_video.py

@@ -57,7 +57,7 @@ class CarryViode:
                     'Content-Type': 'application/json'
                 }
 
-                response = requests.request("POST", url, headers=headers, data=payload, timeout= 30)
+                response = requests.request("POST", url, headers=headers, data=payload, timeout= 60)
                 response = response.json()
                 code = response["code"]
                 if code == 0:
@@ -65,6 +65,9 @@ class CarryViode:
                     video_url = data["video_url_list"][0]["video_url"]
                     original_title = data["title"]
                     return video_url, original_title
+                if code == 22002:
+                    if '抖音内容已被删除或无法访问' in response['msg']:
+                        return "作品不存在", None
             except Exception as e:
                 retry_count += 1
                 logger.error(f"[+] 抖音{url}获取视频链接失败,失败信息{e}")
@@ -227,16 +230,6 @@ class CarryViode:
                 tag_transport_channel = "快手"
                 logger.info(f"[+] {url}开始获取快手视频链接")
                 url, original_title = self.get_text_ks_video(url=url)
-                if url == "作品不存在":
-                    text = (
-                        f"**负责人**: {data['name']}\n"
-                        f"**内容**: {data}\n"
-                        f"**失败信息**: 作品不存在,不做处理\n"
-                    )
-                    Feishu.finish_bot(text,
-                                      "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd",
-                                      "【 搬运&改造效率工具作品不存在,不做处理 】")
-                    return
             else:
                 AliyunLogger.logging(data["name"], "效率工具", "", data["video_url"], "扫描到一条视频",
                                      "2001", str(data))
@@ -252,6 +245,16 @@ class CarryViode:
                                   "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd",
                                   "【 搬运&改造效率工具失败通知 】")
                 return
+            if url == "作品不存在":
+                text = (
+                    f"**负责人**: {data['name']}\n"
+                    f"**内容**: {data}\n"
+                    f"**失败信息**: 作品不存在,不做处理\n"
+                )
+                Feishu.finish_bot(text,
+                                  "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd",
+                                  "【 搬运&改造效率工具作品不存在,不做处理 】")
+                return
         except Exception as e:
             logger.info(f"[+] 获取视频链接异常{e}")
             in_carry_video_data(REDIS_NAME, json.dumps(data, ensure_ascii=False, indent=4))